aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Driver/Tools.cpp
diff options
context:
space:
mode:
authorDean Michael Berris <dberris@google.com>2016-10-27 04:56:14 +0000
committerDean Michael Berris <dberris@google.com>2016-10-27 04:56:14 +0000
commitf469cb9045d1cd2b66e080462f472ba47d913d3f (patch)
tree3e81defb0bb386ab799b3528be6e72275d0ad05e /clang/lib/Driver/Tools.cpp
parentf8520559ce1be64c9f4f0abae7e5e1494341892d (diff)
downloadllvm-f469cb9045d1cd2b66e080462f472ba47d913d3f.zip
llvm-f469cb9045d1cd2b66e080462f472ba47d913d3f.tar.gz
llvm-f469cb9045d1cd2b66e080462f472ba47d913d3f.tar.bz2
[XRay] Check in Clang whether XRay supports the target when -fxray-instrument is passed
Summary: Added the code which explicitly emits an error in Clang in case `-fxray-instrument` is passed, but XRay is not supported for the selected target. Reviewers: rsmith, aaron.ballman, rnk, dberris Differential Revision: https://reviews.llvm.org/D24799 llvm-svn: 285266
Diffstat (limited to 'clang/lib/Driver/Tools.cpp')
-rw-r--r--clang/lib/Driver/Tools.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp
index 74e3681..36b4c95 100644
--- a/clang/lib/Driver/Tools.cpp
+++ b/clang/lib/Driver/Tools.cpp
@@ -4810,7 +4810,16 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
if (Args.hasFlag(options::OPT_fxray_instrument,
options::OPT_fnoxray_instrument, false)) {
- CmdArgs.push_back("-fxray-instrument");
+ const char *const XRayInstrumentOption = "-fxray-instrument";
+ if (Triple.getOS() == llvm::Triple::Linux &&
+ (Triple.getArch() == llvm::Triple::arm ||
+ Triple.getArch() == llvm::Triple::x86_64)) {
+ // Supported.
+ } else {
+ D.Diag(diag::err_drv_clang_unsupported)
+ << (std::string(XRayInstrumentOption) + " on " + Triple.str());
+ }
+ CmdArgs.push_back(XRayInstrumentOption);
if (const Arg *A =
Args.getLastArg(options::OPT_fxray_instruction_threshold_,
options::OPT_fxray_instruction_threshold_EQ)) {