blob: 92a3fa96194cd8fdcff4860bde3804d705ab7c67 [file] [log] [blame]
Kostya Serebryany4c0fc992013-02-26 06:58:27 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
2
3#define NO_SANITIZE_THREAD __attribute__((no_sanitize_thread))
4
5#if !__has_attribute(no_sanitize_thread)
6#error "Should support no_sanitize_thread"
7#endif
Aaron Ballman8b5e7ba2015-10-08 19:24:08 +00008
9void noanal_fun() NO_SANITIZE_THREAD;
10
11void noanal_fun_alt() __attribute__((__no_sanitize_thread__));
12
13void noanal_fun_args() __attribute__((no_sanitize_thread(1))); // \
14 // expected-error {{'no_sanitize_thread' attribute takes no arguments}}
15
Kostya Serebryany4c0fc992013-02-26 06:58:27 +000016int noanal_testfn(int y) NO_SANITIZE_THREAD;
17
18int noanal_testfn(int y) {
19 int x NO_SANITIZE_THREAD = y; // \
Aaron Ballman981ba242014-05-20 14:10:53 +000020 // expected-error {{'no_sanitize_thread' attribute only applies to functions}}
Kostya Serebryany4c0fc992013-02-26 06:58:27 +000021 return x;
22}
23
24int noanal_test_var NO_SANITIZE_THREAD; // \
Aaron Ballman981ba242014-05-20 14:10:53 +000025 // expected-error {{'no_sanitize_thread' attribute only applies to functions}}
Kostya Serebryany4c0fc992013-02-26 06:58:27 +000026
27class NoanalFoo {
28 private:
29 int test_field NO_SANITIZE_THREAD; // \
Aaron Ballman981ba242014-05-20 14:10:53 +000030 // expected-error {{'no_sanitize_thread' attribute only applies to functions}}
Kostya Serebryany4c0fc992013-02-26 06:58:27 +000031 void test_method() NO_SANITIZE_THREAD;
32};
33
34class NO_SANITIZE_THREAD NoanalTestClass { // \
Aaron Ballman981ba242014-05-20 14:10:53 +000035 // expected-error {{'no_sanitize_thread' attribute only applies to functions}}
Kostya Serebryany4c0fc992013-02-26 06:58:27 +000036};
37
38void noanal_fun_params(int lvar NO_SANITIZE_THREAD); // \
Aaron Ballman981ba242014-05-20 14:10:53 +000039 // expected-error {{'no_sanitize_thread' attribute only applies to functions}}