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