[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
Mon Oct 17 05:33:59 PDT 2016


rSerge updated this revision to Diff 74829.

https://reviews.llvm.org/D24799

Files:
  lib/Driver/Tools.cpp


Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -4804,7 +4804,16 @@
 
   if (Args.hasFlag(options::OPT_fxray_instrument,
                    options::OPT_fnoxray_instrument, false)) {
-    CmdArgs.push_back("-fxray-instrument");
+    const std::string 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) << (XRayInstrumentOption + " on "
+        + Triple.str());
+    }
+    CmdArgs.push_back(XRayInstrumentOption.c_str());
     if (const Arg *A =
             Args.getLastArg(options::OPT_fxray_instruction_threshold_,
                             options::OPT_fxray_instruction_threshold_EQ)) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24799.74829.patch
Type: text/x-patch
Size: 945 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161017/dad1c6f8/attachment.bin>


More information about the cfe-commits mailing list