[clang-cl] Ignore /Wv and /Wv:17 flags
[llvm-project.git] / clang / test / SemaCXX / attr-no-sanitize.cpp
blobfeff7ef6163dc2095b1de6a5afecdd492c15aa95
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
5 int f1() __attribute__((no_sanitize)); // expected-error{{'no_sanitize' attribute takes at least 1 argument}}
7 int f2() __attribute__((no_sanitize(1))); // expected-error{{'no_sanitize' attribute requires a string}}
9 // DUMP-LABEL: FunctionDecl {{.*}} f3
10 // DUMP: NoSanitizeAttr {{.*}} address
11 // PRINT: int f3() __attribute__((no_sanitize("address")))
12 int f3() __attribute__((no_sanitize("address")));
14 // DUMP-LABEL: FunctionDecl {{.*}} f4
15 // DUMP: NoSanitizeAttr {{.*}} thread
16 // PRINT: int f4() {{\[\[}}clang::no_sanitize("thread")]]
17 [[clang::no_sanitize("thread")]] int f4();
19 // DUMP-LABEL: FunctionDecl {{.*}} f4
20 // DUMP: NoSanitizeAttr {{.*}} hwaddress
21 // PRINT: int f4() {{\[\[}}clang::no_sanitize("hwaddress")]]
22 [[clang::no_sanitize("hwaddress")]] int f4();
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")));
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}}
34 // DUMP-LABEL: FunctionDecl {{.*}} f7
35 // DUMP: NoSanitizeAttr {{.*}} memtag
36 // PRINT: int f7() {{\[\[}}clang::no_sanitize("memtag")]]
37 [[clang::no_sanitize("memtag")]] int f7();