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 | 149c4f86c32127bfe9841b87e94b097946b5c478 (patch) | |
tree | e6dc63b44a3f0bf9f94f3bd2ccdbafbef1421a1e /lib/Driver | |
parent | b01e9e02909532ea411a3134fffa666b84a95398 (diff) | |
download | clang-149c4f86c32127bfe9841b87e94b097946b5c478.tar.gz |
[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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@283193 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver')
-rw-r--r-- | lib/Driver/Tools.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 5138d7528d..80feca4ed9 100644 --- a/lib/Driver/Tools.cpp +++ b/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)) { |