[PATCH] D24799: [XRay] Check in Clang whether XRay supports the target when -fxray-instrument is passed

Serge Rogatch via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 21 07:26:28 PDT 2016


rSerge created this revision.
rSerge added reviewers: rsmith, dberris.
rSerge added subscribers: cfe-commits, iid_iunknown.
Herald added a subscriber: dberris.

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.

https://reviews.llvm.org/D24799

Files:
  lib/Driver/Tools.cpp

Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -4767,6 +4767,17 @@
 
   if (Args.hasFlag(options::OPT_fxray_instrument,
                    options::OPT_fnoxray_instrument, false)) {
+    switch(getToolChain().getArch()) {
+    case llvm::Triple::arm:
+    case llvm::Triple::x86_64:
+      break;
+    default:
+    {
+      std::string feature("XRay for ");
+      feature += Triple.getArchName().data();
+      D.Diag(diag::err_drv_clang_unsupported) << feature;
+      break;
+    } }
     CmdArgs.push_back("-fxray-instrument");
     if (const Arg *A =
             Args.getLastArg(options::OPT_fxray_instruction_threshold_,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24799.72039.patch
Type: text/x-patch
Size: 749 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160921/636fa7d2/attachment.bin>


More information about the cfe-commits mailing list