summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSagar Thakur <sagar.thakur@imgtec.com>2017-02-15 10:54:09 +0000
committerSagar Thakur <sagar.thakur@imgtec.com>2017-02-15 10:54:09 +0000
commitb66fdad71c3d0909256191465d09b717d76ed1e3 (patch)
tree139abba5af9437981d60bce20a0941229d586cc6 /test
parent987d58d2e2e598413ba12ef07d413e95721e00b7 (diff)
[Compiler-rt][XRAY][MIPS] Support xray on mips/mipsel/mips64/mips64el
Summary: Adds support for xray on mips/mipsel/mips64/mips64el. Reviewed by sdardis, dberris Differential: D27699 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@295166 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/xray/TestCases/Linux/pic_test.cc33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/xray/TestCases/Linux/pic_test.cc b/test/xray/TestCases/Linux/pic_test.cc
new file mode 100644
index 000000000..004f6da2f
--- /dev/null
+++ b/test/xray/TestCases/Linux/pic_test.cc
@@ -0,0 +1,33 @@
+// Test to check if we handle pic code properly.
+
+// RUN: %clangxx_xray -fxray-instrument -std=c++11 -fpic %s -o %t
+// RUN: XRAY_OPTIONS="verbosity=1 xray_logfile_base=pic-test-logging-" %run %t 2>&1 | FileCheck %s
+// After all that, clean up the output xray log.
+//
+// RUN: rm pic-test-logging-*
+
+#include <cstdio>
+
+[[clang::xray_always_instrument]]
+unsigned short foo (unsigned b);
+
+[[clang::xray_always_instrument]]
+unsigned short bar (unsigned short a)
+{
+ printf("bar() is always instrumented!\n");
+ return foo(a);
+}
+
+unsigned short foo (unsigned b)
+{
+ printf("foo() is always instrumented!\n");
+ return b + b + 5;
+}
+
+int main ()
+{
+ // CHECK: XRay: Log file in 'pic-test-logging-{{.*}}'
+ bar(10);
+ // CHECK: bar() is always instrumented!
+ // CHECK-NEXT: foo() is always instrumented!
+}