This revision was automatically updated to reflect the committed changes.
Closed by commit rL285266: [XRay] Check in Clang whether XRay supports the 
target when -fxray-instrument… (authored by dberris).

Changed prior to commit:
  https://reviews.llvm.org/D24799?vs=75452&id=75980#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D24799

Files:
  cfe/trunk/lib/Driver/Tools.cpp
  cfe/trunk/test/Driver/XRay/lit.local.cfg
  cfe/trunk/test/Driver/XRay/xray-instrument-cpu.c
  cfe/trunk/test/Driver/XRay/xray-instrument-os.c


Index: cfe/trunk/test/Driver/XRay/xray-instrument-cpu.c
===================================================================
--- cfe/trunk/test/Driver/XRay/xray-instrument-cpu.c
+++ cfe/trunk/test/Driver/XRay/xray-instrument-cpu.c
@@ -0,0 +1,4 @@
+// RUN: not %clang -v -fxray-instrument -c %s
+// XFAIL: amd64-, x86_64-, x86_64h-, arm
+// REQUIRES: linux
+typedef int a;
Index: cfe/trunk/test/Driver/XRay/lit.local.cfg
===================================================================
--- cfe/trunk/test/Driver/XRay/lit.local.cfg
+++ cfe/trunk/test/Driver/XRay/lit.local.cfg
@@ -0,0 +1,2 @@
+target_triple_components = config.target_triple.split('-')
+config.available_features.update(target_triple_components)
Index: cfe/trunk/test/Driver/XRay/xray-instrument-os.c
===================================================================
--- cfe/trunk/test/Driver/XRay/xray-instrument-os.c
+++ cfe/trunk/test/Driver/XRay/xray-instrument-os.c
@@ -0,0 +1,4 @@
+// RUN: not %clang -v -fxray-instrument -c %s
+// XFAIL: -linux-
+// REQUIRES-ANY: amd64, x86_64, x86_64h, arm
+typedef int a;
Index: cfe/trunk/lib/Driver/Tools.cpp
===================================================================
--- cfe/trunk/lib/Driver/Tools.cpp
+++ cfe/trunk/lib/Driver/Tools.cpp
@@ -4810,7 +4810,16 @@
 
   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)) {


Index: cfe/trunk/test/Driver/XRay/xray-instrument-cpu.c
===================================================================
--- cfe/trunk/test/Driver/XRay/xray-instrument-cpu.c
+++ cfe/trunk/test/Driver/XRay/xray-instrument-cpu.c
@@ -0,0 +1,4 @@
+// RUN: not %clang -v -fxray-instrument -c %s
+// XFAIL: amd64-, x86_64-, x86_64h-, arm
+// REQUIRES: linux
+typedef int a;
Index: cfe/trunk/test/Driver/XRay/lit.local.cfg
===================================================================
--- cfe/trunk/test/Driver/XRay/lit.local.cfg
+++ cfe/trunk/test/Driver/XRay/lit.local.cfg
@@ -0,0 +1,2 @@
+target_triple_components = config.target_triple.split('-')
+config.available_features.update(target_triple_components)
Index: cfe/trunk/test/Driver/XRay/xray-instrument-os.c
===================================================================
--- cfe/trunk/test/Driver/XRay/xray-instrument-os.c
+++ cfe/trunk/test/Driver/XRay/xray-instrument-os.c
@@ -0,0 +1,4 @@
+// RUN: not %clang -v -fxray-instrument -c %s
+// XFAIL: -linux-
+// REQUIRES-ANY: amd64, x86_64, x86_64h, arm
+typedef int a;
Index: cfe/trunk/lib/Driver/Tools.cpp
===================================================================
--- cfe/trunk/lib/Driver/Tools.cpp
+++ cfe/trunk/lib/Driver/Tools.cpp
@@ -4810,7 +4810,16 @@
 
   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)) {
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to