diff options
author | Dean Michael Berris <dberris@google.com> | 2016-10-04 08:22:47 +0000 |
---|---|---|
committer | Dean Michael Berris <dberris@google.com> | 2016-10-04 08:22:47 +0000 |
commit | 5db9121b31a1935fa1fa53cf3b308ea6849ea965 (patch) | |
tree | 8d4d785a134a18ea0ccce4ce32e3f1daa26dd2f1 /clang/lib/Driver/Tools.cpp | |
parent | 535529b41c9d1a1b52ee755008018f27a0bb4fec (diff) | |
download | llvm-5db9121b31a1935fa1fa53cf3b308ea6849ea965.zip llvm-5db9121b31a1935fa1fa53cf3b308ea6849ea965.tar.gz llvm-5db9121b31a1935fa1fa53cf3b308ea6849ea965.tar.bz2 |
[XRay] Check in Clang whether XRay supports the target when -fxray-instrument is passed
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.
Author: rSerge
Reviewers: dberris, rsmith, aaron.ballman, rnk
Subscribers: cfe-commits, iid_iunknown
Differential Revision: https://reviews.llvm.org/D24799
llvm-svn: 283193
Diffstat (limited to 'clang/lib/Driver/Tools.cpp')
-rw-r--r-- | clang/lib/Driver/Tools.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 5138d75..80feca4 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -4777,7 +4777,20 @@ 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"; + switch (getToolChain().getArch()) { + case llvm::Triple::arm: + case llvm::Triple::x86_64: + break; + default: { + std::string Feature(XRayInstrumentOption); + Feature += " on "; + Feature += Triple.getArchName().data(); + D.Diag(diag::err_drv_clang_unsupported) << Feature; + break; + } + } + CmdArgs.push_back(XRayInstrumentOption); if (const Arg *A = Args.getLastArg(options::OPT_fxray_instruction_threshold_, options::OPT_fxray_instruction_threshold_EQ)) { |