1// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s 2// RUN: not %clang_cc1 -std=c++11 -ast-dump %s | FileCheck --check-prefix=DUMP %s 3// RUN: not %clang_cc1 -std=c++11 -ast-print %s | FileCheck --check-prefix=PRINT %s 4 5int v1 __attribute__((no_sanitize("address"))); // expected-error{{'no_sanitize' attribute only applies to functions and methods}} 6 7int f1() __attribute__((no_sanitize)); // expected-error{{'no_sanitize' attribute takes at least 1 argument}} 8 9int f2() __attribute__((no_sanitize(1))); // expected-error{{'no_sanitize' attribute requires a string}} 10 11// DUMP-LABEL: FunctionDecl {{.*}} f3 12// DUMP: NoSanitizeAttr {{.*}} address 13// PRINT: int f3() __attribute__((no_sanitize("address"))) 14int f3() __attribute__((no_sanitize("address"))); 15 16// DUMP-LABEL: FunctionDecl {{.*}} f4 17// DUMP: NoSanitizeAttr {{.*}} thread 18// PRINT: int f4() {{\[\[}}clang::no_sanitize("thread")]] 19[[clang::no_sanitize("thread")]] int f4(); 20 21// DUMP-LABEL: FunctionDecl {{.*}} f5 22// DUMP: NoSanitizeAttr {{.*}} address thread 23// PRINT: int f5() __attribute__((no_sanitize("address", "thread"))) 24int f5() __attribute__((no_sanitize("address", "thread"))); 25 26// DUMP-LABEL: FunctionDecl {{.*}} f6 27// DUMP: NoSanitizeAttr {{.*}} unknown 28// PRINT: int f6() __attribute__((no_sanitize("unknown"))) 29int f6() __attribute__((no_sanitize("unknown"))); // expected-warning{{unknown sanitizer 'unknown' ignored}} 30