40 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s2 3#define NO_SANITIZE_MEMORY __attribute__((no_sanitize_memory))4 5#if !__has_attribute(no_sanitize_memory)6#error "Should support no_sanitize_memory"7#endif8 9void no_analyze() NO_SANITIZE_MEMORY;10 11void no_analyze_alt() __attribute__((__no_sanitize_memory__));12 13void no_analyze_args() __attribute__((no_sanitize_memory(1))); // \14 // expected-error {{'no_sanitize_memory' attribute takes no arguments}}15 16int no_analyze_testfn(int y) NO_SANITIZE_MEMORY;17 18int no_analyze_testfn(int y) {19 int x NO_SANITIZE_MEMORY = y; // \20 // expected-error {{'no_sanitize_memory' attribute only applies to functions}}21 return x;22}23 24int no_analyze_test_var NO_SANITIZE_MEMORY; // \25 // expected-error {{'no_sanitize_memory' attribute only applies to functions}}26 27class NoAnalyzeFoo {28 private:29 int test_field NO_SANITIZE_MEMORY; // \30 // expected-error {{'no_sanitize_memory' attribute only applies to functions}}31 void test_method() NO_SANITIZE_MEMORY;32};33 34class NO_SANITIZE_MEMORY NoAnalyzeTestClass { // \35 // expected-error {{'no_sanitize_memory' attribute only applies to functions}}36};37 38void no_analyze_params(int lvar NO_SANITIZE_MEMORY); // \39 // expected-error {{'no_sanitize_memory' attribute only applies to functions}}40