blob: 50960c42b931f37453a182cd8d20018608dca1d9 [file] [log] [blame]
Kostya Serebryany85aee962013-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
8
9void noanal_fun() NO_SANITIZE_THREAD;
10
11void noanal_fun_args() __attribute__((no_sanitize_thread(1))); // \
12 // expected-error {{attribute takes no arguments}}
13
14int noanal_testfn(int y) NO_SANITIZE_THREAD;
15
16int noanal_testfn(int y) {
17 int x NO_SANITIZE_THREAD = y; // \
18 // expected-error {{'no_sanitize_thread' attribute only applies to functions and methods}}
19 return x;
20}
21
22int noanal_test_var NO_SANITIZE_THREAD; // \
23 // expected-error {{'no_sanitize_thread' attribute only applies to functions and methods}}
24
25class NoanalFoo {
26 private:
27 int test_field NO_SANITIZE_THREAD; // \
28 // expected-error {{'no_sanitize_thread' attribute only applies to functions and methods}}
29 void test_method() NO_SANITIZE_THREAD;
30};
31
32class NO_SANITIZE_THREAD NoanalTestClass { // \
33 // expected-error {{'no_sanitize_thread' attribute only applies to functions and methods}}
34};
35
36void noanal_fun_params(int lvar NO_SANITIZE_THREAD); // \
37 // expected-error {{'no_sanitize_thread' attribute only applies to functions and methods}}