diff options
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/CodeGen/xray-attributes-supported.cpp | 13 | ||||
-rw-r--r-- | clang/test/Sema/xray-always-instrument-attr.c | 6 | ||||
-rw-r--r-- | clang/test/Sema/xray-always-instrument-attr.cpp | 10 |
3 files changed, 29 insertions, 0 deletions
diff --git a/clang/test/CodeGen/xray-attributes-supported.cpp b/clang/test/CodeGen/xray-attributes-supported.cpp new file mode 100644 index 00000000000..d70b3aa2601 --- /dev/null +++ b/clang/test/CodeGen/xray-attributes-supported.cpp @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 %s -fxray-instrument -std=c++11 -x c++ -emit-llvm -o - -triple x86_64-unknown-linux-gnu | FileCheck %s + +// Make sure that the LLVM attribute for XRay-annotated functions do show up. +[[clang::xray_always_instrument]] void foo() { +// CHECK: define void @_Z3foov() #0 +}; + +[[clang::xray_never_instrument]] void bar() { +// CHECK: define void @_Z3barv() #1 +}; + +// CHECK: #0 = {{.*}}"function-instrument"="xray-always" +// CHECK: #1 = {{.*}}"function-instrument"="xray-never" diff --git a/clang/test/Sema/xray-always-instrument-attr.c b/clang/test/Sema/xray-always-instrument-attr.c new file mode 100644 index 00000000000..3c063e21a68 --- /dev/null +++ b/clang/test/Sema/xray-always-instrument-attr.c @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 %s -verify -fsyntax-only -std=c11 +void foo() __attribute__((xray_always_instrument)); + +struct __attribute__((xray_always_instrument)) a { int x; }; // expected-warning {{'xray_always_instrument' attribute only applies to functions and methods}} + +void bar() __attribute__((xray_always_instrument("not-supported"))); // expected-error {{'xray_always_instrument' attribute takes no arguments}} diff --git a/clang/test/Sema/xray-always-instrument-attr.cpp b/clang/test/Sema/xray-always-instrument-attr.cpp new file mode 100644 index 00000000000..8d42837ec6b --- /dev/null +++ b/clang/test/Sema/xray-always-instrument-attr.cpp @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 %s -verify -fsyntax-only -std=c++11 -x c++ +void foo [[clang::xray_always_instrument]] (); + +struct [[clang::xray_always_instrument]] a { int x; }; // expected-warning {{'xray_always_instrument' attribute only applies to functions and methods}} + +class b { + void c [[clang::xray_always_instrument]] (); +}; + +void baz [[clang::xray_always_instrument("not-supported")]] (); // expected-error {{'xray_always_instrument' attribute takes no arguments}} |