Peter Collingbourne | 915df99 | 2015-05-15 18:33:32 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s |
NAKAMURA Takumi | e712f0a | 2015-05-16 00:09:39 +0000 | [diff] [blame] | 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 |
Peter Collingbourne | 915df99 | 2015-05-15 18:33:32 +0000 | [diff] [blame] | 4 | |
| 5 | int v1 __attribute__((no_sanitize("address"))); // expected-error{{'no_sanitize' attribute only applies to functions and methods}} |
| 6 | |
| 7 | int f1() __attribute__((no_sanitize)); // expected-error{{'no_sanitize' attribute takes at least 1 argument}} |
| 8 | |
| 9 | int 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"))) |
| 14 | int 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"))) |
| 24 | int f5() __attribute__((no_sanitize("address", "thread"))); |
| 25 | |
| 26 | // DUMP-LABEL: FunctionDecl {{.*}} f6 |
| 27 | // DUMP: NoSanitizeAttr {{.*}} unknown |
| 28 | // PRINT: int f6() __attribute__((no_sanitize("unknown"))) |
| 29 | int f6() __attribute__((no_sanitize("unknown"))); // expected-warning{{unknown sanitizer 'unknown' ignored}} |