aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Basic/XRayInstr.cpp
diff options
context:
space:
mode:
authorJan Svoboda <jan_svoboda@apple.com>2021-02-09 11:42:01 +0100
committerJan Svoboda <jan_svoboda@apple.com>2021-02-09 11:43:38 +0100
commite721bc9effefab8a625e913e7391bdd340693ddc (patch)
tree2d8f9cc85138718e8e36f8ddbc07795689b69eb2 /clang/lib/Basic/XRayInstr.cpp
parentec12f5febed04dd32e7d4b766b2853d50fca9657 (diff)
downloadllvm-e721bc9effefab8a625e913e7391bdd340693ddc.zip
llvm-e721bc9effefab8a625e913e7391bdd340693ddc.tar.gz
llvm-e721bc9effefab8a625e913e7391bdd340693ddc.tar.bz2
[clang][cli] Generate and round-trip CodeGen options
This patch implements generation of remaining codegen options and tests it by performing parse-generate-parse round trip. Reviewed By: dexonsmith Differential Revision: https://reviews.llvm.org/D96056
Diffstat (limited to 'clang/lib/Basic/XRayInstr.cpp')
-rw-r--r--clang/lib/Basic/XRayInstr.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/clang/lib/Basic/XRayInstr.cpp b/clang/lib/Basic/XRayInstr.cpp
index 79052e0..822e14b 100644
--- a/clang/lib/Basic/XRayInstr.cpp
+++ b/clang/lib/Basic/XRayInstr.cpp
@@ -11,6 +11,7 @@
//===----------------------------------------------------------------------===//
#include "clang/Basic/XRayInstr.h"
+#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringSwitch.h"
namespace clang {
@@ -30,4 +31,30 @@ XRayInstrMask parseXRayInstrValue(StringRef Value) {
return ParsedKind;
}
+void serializeXRayInstrValue(XRayInstrSet Set,
+ SmallVectorImpl<StringRef> &Values) {
+ if (Set.Mask == XRayInstrKind::All) {
+ Values.push_back("all");
+ return;
+ }
+
+ if (Set.Mask == XRayInstrKind::None) {
+ Values.push_back("none");
+ return;
+ }
+
+ if (Set.has(XRayInstrKind::Custom))
+ Values.push_back("custom");
+
+ if (Set.has(XRayInstrKind::Typed))
+ Values.push_back("typed");
+
+ if (Set.has(XRayInstrKind::FunctionEntry) &&
+ Set.has(XRayInstrKind::FunctionExit))
+ Values.push_back("function");
+ else if (Set.has(XRayInstrKind::FunctionEntry))
+ Values.push_back("function-entry");
+ else if (Set.has(XRayInstrKind::FunctionExit))
+ Values.push_back("function-exit");
+}
} // namespace clang