summaryrefslogtreecommitdiff
path: root/lib/Driver/XRayArgs.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Driver/XRayArgs.cpp')
-rw-r--r--lib/Driver/XRayArgs.cpp33
1 files changed, 29 insertions, 4 deletions
diff --git a/lib/Driver/XRayArgs.cpp b/lib/Driver/XRayArgs.cpp
index 30b0e72760c95..1a48493d7dc7b 100644
--- a/lib/Driver/XRayArgs.cpp
+++ b/lib/Driver/XRayArgs.cpp
@@ -50,13 +50,23 @@ XRayArgs::XRayArgs(const ToolChain &TC, const ArgList &Args) {
D.Diag(diag::err_drv_clang_unsupported)
<< (std::string(XRayInstrumentOption) + " on " + Triple.str());
}
- } else if (Triple.getOS() == llvm::Triple::FreeBSD ||
- Triple.getOS() == llvm::Triple::OpenBSD ||
- Triple.getOS() == llvm::Triple::NetBSD) {
+ } else if (Triple.isOSFreeBSD() ||
+ Triple.isOSOpenBSD() ||
+ Triple.isOSNetBSD() ||
+ Triple.getOS() == llvm::Triple::Darwin) {
if (Triple.getArch() != llvm::Triple::x86_64) {
D.Diag(diag::err_drv_clang_unsupported)
<< (std::string(XRayInstrumentOption) + " on " + Triple.str());
}
+ } else if (Triple.getOS() == llvm::Triple::Fuchsia) {
+ switch (Triple.getArch()) {
+ case llvm::Triple::x86_64:
+ case llvm::Triple::aarch64:
+ break;
+ default:
+ D.Diag(diag::err_drv_clang_unsupported)
+ << (std::string(XRayInstrumentOption) + " on " + Triple.str());
+ }
} else {
D.Diag(diag::err_drv_clang_unsupported)
<< (std::string(XRayInstrumentOption) + " on " + Triple.str());
@@ -164,7 +174,7 @@ XRayArgs::XRayArgs(const ToolChain &TC, const ArgList &Args) {
}
// Then we want to sort and unique the modes we've collected.
- llvm::sort(Modes.begin(), Modes.end());
+ llvm::sort(Modes);
Modes.erase(std::unique(Modes.begin(), Modes.end()), Modes.end());
}
}
@@ -214,4 +224,19 @@ void XRayArgs::addArgs(const ToolChain &TC, const ArgList &Args,
ModeOpt += Mode;
CmdArgs.push_back(Args.MakeArgString(ModeOpt));
}
+
+ SmallString<64> Bundle("-fxray-instrumentation-bundle=");
+ if (InstrumentationBundle.full()) {
+ Bundle += "all";
+ } else if (InstrumentationBundle.empty()) {
+ Bundle += "none";
+ } else {
+ if (InstrumentationBundle.has(XRayInstrKind::Function))
+ Bundle += "function";
+ if (InstrumentationBundle.has(XRayInstrKind::Custom))
+ Bundle += "custom";
+ if (InstrumentationBundle.has(XRayInstrKind::Typed))
+ Bundle += "typed";
+ }
+ CmdArgs.push_back(Args.MakeArgString(Bundle));
}