2013-02-26 14:58:27 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
|
|
|
|
|
|
|
#define NO_SANITIZE_MEMORY __attribute__((no_sanitize_memory))
|
|
|
|
|
|
|
|
#if !__has_attribute(no_sanitize_memory)
|
|
|
|
#error "Should support no_sanitize_memory"
|
|
|
|
#endif
|
2016-01-03 23:55:40 +08:00
|
|
|
|
2019-05-22 06:43:48 +08:00
|
|
|
void no_analyze() NO_SANITIZE_MEMORY;
|
2016-01-03 23:55:40 +08:00
|
|
|
|
2019-05-22 06:43:48 +08:00
|
|
|
void no_analyze_alt() __attribute__((__no_sanitize_memory__));
|
2016-01-03 23:55:40 +08:00
|
|
|
|
2019-05-22 06:43:48 +08:00
|
|
|
void no_analyze_args() __attribute__((no_sanitize_memory(1))); // \
|
2016-01-03 23:55:40 +08:00
|
|
|
// expected-error {{'no_sanitize_memory' attribute takes no arguments}}
|
|
|
|
|
2019-05-22 06:43:48 +08:00
|
|
|
int no_analyze_testfn(int y) NO_SANITIZE_MEMORY;
|
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_MEMORY = y; // \
|
2014-05-20 22:10:53 +08:00
|
|
|
// expected-error {{'no_sanitize_memory' 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_MEMORY; // \
|
2014-05-20 22:10:53 +08:00
|
|
|
// expected-error {{'no_sanitize_memory' 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_MEMORY; // \
|
2014-05-20 22:10:53 +08:00
|
|
|
// expected-error {{'no_sanitize_memory' attribute only applies to functions}}
|
2013-02-26 14:58:27 +08:00
|
|
|
void test_method() NO_SANITIZE_MEMORY;
|
|
|
|
};
|
|
|
|
|
2019-05-22 06:43:48 +08:00
|
|
|
class NO_SANITIZE_MEMORY NoAnalyzeTestClass { // \
|
2014-05-20 22:10:53 +08:00
|
|
|
// expected-error {{'no_sanitize_memory' 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_MEMORY); // \
|
2014-05-20 22:10:53 +08:00
|
|
|
// expected-error {{'no_sanitize_memory' attribute only applies to functions}}
|