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 
5 int f1() __attribute__((no_sanitize)); // expected-error{{'no_sanitize' attribute takes at least 1 argument}}
6 
7 int f2() __attribute__((no_sanitize(1))); // expected-error{{'no_sanitize' attribute requires a string}}
8 
9 // DUMP-LABEL: FunctionDecl {{.*}} f3
10 // DUMP: NoSanitizeAttr {{.*}} address
11 // PRINT: int f3() __attribute__((no_sanitize("address")))
12 int f3() __attribute__((no_sanitize("address")));
13 
14 // DUMP-LABEL: FunctionDecl {{.*}} f4
15 // DUMP: NoSanitizeAttr {{.*}} thread
16 // PRINT: int f4() {{\[\[}}clang::no_sanitize("thread")]]
17 [[clang::no_sanitize("thread")]] int f4();
18 
19 // DUMP-LABEL: FunctionDecl {{.*}} f4
20 // DUMP: NoSanitizeAttr {{.*}} hwaddress
21 // PRINT: int f4() {{\[\[}}clang::no_sanitize("hwaddress")]]
22 [[clang::no_sanitize("hwaddress")]] int f4();
23 
24 // DUMP-LABEL: FunctionDecl {{.*}} f5
25 // DUMP: NoSanitizeAttr {{.*}} address thread hwaddress
26 // PRINT: int f5() __attribute__((no_sanitize("address", "thread", "hwaddress")))
27 int f5() __attribute__((no_sanitize("address", "thread", "hwaddress")));
28 
29 // DUMP-LABEL: FunctionDecl {{.*}} f6
30 // DUMP: NoSanitizeAttr {{.*}} unknown
31 // PRINT: int f6() __attribute__((no_sanitize("unknown")))
32 int f6() __attribute__((no_sanitize("unknown"))); // expected-warning{{unknown sanitizer 'unknown' ignored}}
33 
34 // DUMP-LABEL: FunctionDecl {{.*}} f7
35 // DUMP: NoSanitizeAttr {{.*}} memtag
36 // PRINT: int f7() {{\[\[}}clang::no_sanitize("memtag")]]
37 [[clang::no_sanitize("memtag")]] int f7();
38