diff options
author | Dean Michael Berris <dberris@google.com> | 2018-04-13 02:31:58 +0000 |
---|---|---|
committer | Dean Michael Berris <dberris@google.com> | 2018-04-13 02:31:58 +0000 |
commit | 488f7c2b67f5a3811cab59577da367cc45984e28 (patch) | |
tree | 906e9a3c8365cc7a3d9b2681b064aa2450e85521 /clang/lib/Basic/XRayInstr.cpp | |
parent | 35ad9ee3cb346904f459090b0d46cb85a050c287 (diff) | |
download | bcm5719-llvm-488f7c2b67f5a3811cab59577da367cc45984e28.tar.gz bcm5719-llvm-488f7c2b67f5a3811cab59577da367cc45984e28.zip |
[XRay][clang] Add flag to choose instrumentation bundles
Summary:
This change addresses http://llvm.org/PR36926 by allowing users to pick
which instrumentation bundles to use, when instrumenting with XRay. In
particular, the flag `-fxray-instrumentation-bundle=` has four valid
values:
- `all`: the default, emits all instrumentation kinds
- `none`: equivalent to -fnoxray-instrument
- `function`: emits the entry/exit instrumentation
- `custom`: emits the custom event instrumentation
These can be combined either as comma-separated values, or as
repeated flag values.
Reviewers: echristo, kpw, eizan, pelikan
Reviewed By: pelikan
Subscribers: mgorny, cfe-commits
Differential Revision: https://reviews.llvm.org/D44970
llvm-svn: 329985
Diffstat (limited to 'clang/lib/Basic/XRayInstr.cpp')
-rw-r--r-- | clang/lib/Basic/XRayInstr.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/clang/lib/Basic/XRayInstr.cpp b/clang/lib/Basic/XRayInstr.cpp new file mode 100644 index 00000000000..42f9038890a --- /dev/null +++ b/clang/lib/Basic/XRayInstr.cpp @@ -0,0 +1,29 @@ +//===--- XRayInstr.cpp ------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This is part of XRay, a function call instrumentation system. +// +//===----------------------------------------------------------------------===// + +#include "clang/Basic/XRayInstr.h" +#include "llvm/ADT/StringSwitch.h" + +namespace clang { + +XRayInstrMask parseXRayInstrValue(StringRef Value) { + XRayInstrMask ParsedKind = llvm::StringSwitch<XRayInstrMask>(Value) + .Case("all", XRayInstrKind::All) + .Case("custom", XRayInstrKind::Custom) + .Case("function", XRayInstrKind::Function) + .Case("none", XRayInstrKind::None) + .Default(XRayInstrKind::None); + return ParsedKind; +} + +} // namespace clang |