diff options
author | dim <dim@FreeBSD.org> | 2013-04-08 18:45:10 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2013-04-08 18:45:10 +0000 |
commit | c72c57c9e9b69944e3e009cd5e209634839581d3 (patch) | |
tree | 4fc2f184c499d106f29a386c452b49e5197bf63d /test/SemaCXX/attr-no-sanitize-memory.cpp | |
parent | 5b20025c30d23d521e12c1f33ec8fa6b821952cd (diff) | |
download | FreeBSD-src-c72c57c9e9b69944e3e009cd5e209634839581d3.zip FreeBSD-src-c72c57c9e9b69944e3e009cd5e209634839581d3.tar.gz |
Vendor import of clang trunk r178860:
http://llvm.org/svn/llvm-project/cfe/trunk@178860
Diffstat (limited to 'test/SemaCXX/attr-no-sanitize-memory.cpp')
-rw-r--r-- | test/SemaCXX/attr-no-sanitize-memory.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/test/SemaCXX/attr-no-sanitize-memory.cpp b/test/SemaCXX/attr-no-sanitize-memory.cpp new file mode 100644 index 0000000..84acdac --- /dev/null +++ b/test/SemaCXX/attr-no-sanitize-memory.cpp @@ -0,0 +1,37 @@ +// 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))); // \ + // expected-error {{attribute takes no arguments}} + +int noanal_testfn(int y) NO_SANITIZE_MEMORY; + +int noanal_testfn(int y) { + int x NO_SANITIZE_MEMORY = y; // \ + // expected-error {{'no_sanitize_memory' attribute only applies to functions and methods}} + return x; +} + +int noanal_test_var NO_SANITIZE_MEMORY; // \ + // expected-error {{'no_sanitize_memory' attribute only applies to functions and methods}} + +class NoanalFoo { + private: + int test_field NO_SANITIZE_MEMORY; // \ + // expected-error {{'no_sanitize_memory' attribute only applies to functions and methods}} + void test_method() NO_SANITIZE_MEMORY; +}; + +class NO_SANITIZE_MEMORY NoanalTestClass { // \ + // expected-error {{'no_sanitize_memory' attribute only applies to functions and methods}} +}; + +void noanal_fun_params(int lvar NO_SANITIZE_MEMORY); // \ + // expected-error {{'no_sanitize_memory' attribute only applies to functions and methods}} |