diff options
| author | Dean Michael Berris <dberris@google.com> | 2017-03-30 00:29:36 +0000 |
|---|---|---|
| committer | Dean Michael Berris <dberris@google.com> | 2017-03-30 00:29:36 +0000 |
| commit | 835832d37af3401601264fcd620e9af5720f041f (patch) | |
| tree | 63202a36d92c4b7847d77cf960a5c9749f6c0cb5 /clang/test/CodeGen/xray-always-instrument.cpp | |
| parent | 2ccbac3fee49665c19a201d98e3f2690f50edd3a (diff) | |
| download | bcm5719-llvm-835832d37af3401601264fcd620e9af5720f041f.tar.gz bcm5719-llvm-835832d37af3401601264fcd620e9af5720f041f.zip | |
[XRay] Add -fxray-{always,never}-instrument= flags to clang
Summary:
The -fxray-always-instrument= and -fxray-never-instrument= flags take
filenames that are used to imbue the XRay instrumentation attributes
using a whitelist mechanism (similar to the sanitizer special cases
list). We use the same syntax and semantics as the sanitizer blacklists
files in the implementation.
As implemented, we respect the attributes that are already defined in
the source file (i.e. those that have the
[[clang::xray_{always,never}_instrument]] attributes) before applying
the always/never instrument lists.
Reviewers: rsmith, chandlerc
Subscribers: jfb, mgorny, cfe-commits
Differential Revision: https://reviews.llvm.org/D30388
llvm-svn: 299041
Diffstat (limited to 'clang/test/CodeGen/xray-always-instrument.cpp')
| -rw-r--r-- | clang/test/CodeGen/xray-always-instrument.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/test/CodeGen/xray-always-instrument.cpp b/clang/test/CodeGen/xray-always-instrument.cpp new file mode 100644 index 00000000000..60d85956995 --- /dev/null +++ b/clang/test/CodeGen/xray-always-instrument.cpp @@ -0,0 +1,15 @@ +// RUN: echo "fun:*foo*" > %t.always-instrument +// RUN: echo "src:*xray-always-instrument.cpp" >> %t.always-instrument +// RUN: %clang_cc1 -fxray-instrument -x c++ -std=c++11 -fxray-always-instrument=%t.always-instrument -emit-llvm -o - %s -triple x86_64-unknown-linux-gnu | FileCheck %s + +void foo() {} + +[[clang::xray_never_instrument]] void bar() {} + +void baz() {} + +// CHECK: define void @_Z3foov() #[[ALWAYSATTR:[0-9]+]] { +// CHECK: define void @_Z3barv() #[[NEVERATTR:[0-9]+]] { +// CHECK: define void @_Z3bazv() #[[ALWAYSATTR:[0-9]+]] { +// CHECK: attributes #[[ALWAYSATTR]] = {{.*}} "function-instrument"="xray-always" {{.*}} +// CHECK: attributes #[[NEVERATTR]] = {{.*}} "function-instrument"="xray-never" {{.*}} |

