]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/SemaCXX/attr-no-sanitize.cpp
Vendor import of clang trunk r290819:
[FreeBSD/FreeBSD.git] / test / SemaCXX / attr-no-sanitize.cpp
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 {{.*}} f5
20 // DUMP: NoSanitizeAttr {{.*}} address thread
21 // PRINT: int f5() __attribute__((no_sanitize("address", "thread")))
22 int f5() __attribute__((no_sanitize("address", "thread")));
23
24 // DUMP-LABEL: FunctionDecl {{.*}} f6
25 // DUMP: NoSanitizeAttr {{.*}} unknown
26 // PRINT: int f6() __attribute__((no_sanitize("unknown")))
27 int f6() __attribute__((no_sanitize("unknown"))); // expected-warning{{unknown sanitizer 'unknown' ignored}}