• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -fsyntax-only -verify  %s
2 
3 #define NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address))
4 
5 #if !__has_attribute(no_sanitize_address)
6 #error "Should support no_sanitize_address"
7 #endif
8 
9 void noanal_fun() NO_SANITIZE_ADDRESS;
10 
11 void noanal_fun_alt() __attribute__((__no_sanitize_address__));
12 
13 void noanal_fun_args() __attribute__((no_sanitize_address(1))); // \
14   // expected-error {{'no_sanitize_address' attribute takes no arguments}}
15 
16 int noanal_testfn(int y) NO_SANITIZE_ADDRESS;
17 
noanal_testfn(int y)18 int noanal_testfn(int y) {
19   int x NO_SANITIZE_ADDRESS = y; // \
20     // expected-error {{'no_sanitize_address' attribute only applies to functions}}
21   return x;
22 }
23 
24 int noanal_test_var NO_SANITIZE_ADDRESS; // \
25   // expected-error {{'no_sanitize_address' attribute only applies to functions}}
26 
27 class NoanalFoo {
28  private:
29   int test_field NO_SANITIZE_ADDRESS; // \
30     // expected-error {{'no_sanitize_address' attribute only applies to functions}}
31   void test_method() NO_SANITIZE_ADDRESS;
32 };
33 
34 class NO_SANITIZE_ADDRESS NoanalTestClass { // \
35   // expected-error {{'no_sanitize_address' attribute only applies to functions}}
36 };
37 
38 void noanal_fun_params(int lvar NO_SANITIZE_ADDRESS); // \
39   // expected-error {{'no_sanitize_address' attribute only applies to functions}}
40