summaryrefslogtreecommitdiff
path: root/test/CodeGen/xray-attributes-supported.cpp
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2016-07-13 22:32:15 +0000
committerAaron Ballman <aaron@aaronballman.com>2016-07-13 22:32:15 +0000
commitd1642265a78e95e9050fbd574554a7f53ae0c649 (patch)
tree9ccae9b269ffea1616239692c678c2d3fc64b780 /test/CodeGen/xray-attributes-supported.cpp
parent1ae6e480095d887215db836932c651e0f8f748dc (diff)
downloadclang-d1642265a78e95e9050fbd574554a7f53ae0c649.tar.gz
Add XRay flags to Clang. We implement two flags to control the XRay behaviour:
-fxray-instrument: enables XRay annotation of IR -fxray-instruction-threshold: configures the threshold for function size (looking at IR instructions), and allow LLVM to decide whether to add the nop sleds later on in the process. Also implements the related xray_always_instrument and xray_never_instrument function attributes. Patch by Dean Michael Berris. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@275330 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/xray-attributes-supported.cpp')
-rw-r--r--test/CodeGen/xray-attributes-supported.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/CodeGen/xray-attributes-supported.cpp b/test/CodeGen/xray-attributes-supported.cpp
new file mode 100644
index 0000000000..d70b3aa260
--- /dev/null
+++ b/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"