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
|
|
|
|
|
|
|
|
void noanal_fun() NO_SANITIZE_MEMORY;
|
|
|
|
|
|
|
|
void noanal_fun_args() __attribute__((no_sanitize_memory(1))); // \
|
2013-07-24 03:30:11 +08:00
|
|
|
// expected-error {{'no_sanitize_memory' attribute takes no arguments}}
|
2013-02-26 14:58:27 +08:00
|
|
|
|
|
|
|
int noanal_testfn(int y) NO_SANITIZE_MEMORY;
|
|
|
|
|
|
|
|
int noanal_testfn(int y) {
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
int noanal_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
|
|
|
|
|
|
|
class NoanalFoo {
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
|
|
|
class NO_SANITIZE_MEMORY NoanalTestClass { // \
|
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 noanal_fun_params(int lvar NO_SANITIZE_MEMORY); // \
|
2014-05-20 22:10:53 +08:00
|
|
|
// expected-error {{'no_sanitize_memory' attribute only applies to functions}}
|