2013-02-26 14:58:27 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
|
|
|
|
|
|
|
#define NO_SANITIZE_THREAD __attribute__((no_sanitize_thread))
|
|
|
|
|
|
|
|
#if !__has_attribute(no_sanitize_thread)
|
|
|
|
#error "Should support no_sanitize_thread"
|
|
|
|
#endif
|
2016-01-03 23:55:40 +08:00
|
|
|
|
2019-05-22 06:43:48 +08:00
|
|
|
void no_analyze_fun() NO_SANITIZE_THREAD;
|
2016-01-03 23:55:40 +08:00
|
|
|
|
2019-05-22 06:43:48 +08:00
|
|
|
void no_analyze_alt() __attribute__((__no_sanitize_thread__));
|
2016-01-03 23:55:40 +08:00
|
|
|
|
2019-05-22 06:43:48 +08:00
|
|
|
void no_analyze_args() __attribute__((no_sanitize_thread(1))); // \
|
2016-01-03 23:55:40 +08:00
|
|
|
// expected-error {{'no_sanitize_thread' attribute takes no arguments}}
|
|
|
|
|
2019-05-22 06:43:48 +08:00
|
|
|
int no_analyze_testfn(int y) NO_SANITIZE_THREAD;
|
2013-02-26 14:58:27 +08:00
|
|
|
|
2019-05-22 06:43:48 +08:00
|
|
|
int no_analyze_testfn(int y) {
|
2013-02-26 14:58:27 +08:00
|
|
|
int x NO_SANITIZE_THREAD = y; // \
|
2014-05-20 22:10:53 +08:00
|
|
|
// expected-error {{'no_sanitize_thread' attribute only applies to functions}}
|
2013-02-26 14:58:27 +08:00
|
|
|
return x;
|
|
|
|
}
|
|
|
|
|
2019-05-22 06:43:48 +08:00
|
|
|
int no_analyze_test_var NO_SANITIZE_THREAD; // \
|
2014-05-20 22:10:53 +08:00
|
|
|
// expected-error {{'no_sanitize_thread' attribute only applies to functions}}
|
2013-02-26 14:58:27 +08:00
|
|
|
|
2019-05-22 06:43:48 +08:00
|
|
|
class NoAnalyzeFoo {
|
2013-02-26 14:58:27 +08:00
|
|
|
private:
|
|
|
|
int test_field NO_SANITIZE_THREAD; // \
|
2014-05-20 22:10:53 +08:00
|
|
|
// expected-error {{'no_sanitize_thread' attribute only applies to functions}}
|
2013-02-26 14:58:27 +08:00
|
|
|
void test_method() NO_SANITIZE_THREAD;
|
|
|
|
};
|
|
|
|
|
2019-05-22 06:43:48 +08:00
|
|
|
class NO_SANITIZE_THREAD NoAnalyzeTestClass { // \
|
2014-05-20 22:10:53 +08:00
|
|
|
// expected-error {{'no_sanitize_thread' attribute only applies to functions}}
|
2013-02-26 14:58:27 +08:00
|
|
|
};
|
|
|
|
|
2019-05-22 06:43:48 +08:00
|
|
|
void no_analyze_params(int lvar NO_SANITIZE_THREAD); // \
|
2014-05-20 22:10:53 +08:00
|
|
|
// expected-error {{'no_sanitize_thread' attribute only applies to functions}}
|