[clang] f39000b - [Driver] Delete CC1 -fxray-function-index and clean up some tests

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 17 13:00:32 PDT 2020


Author: Fangrui Song
Date: 2020-06-17T13:00:22-07:00
New Revision: f39000b4505bcfe3d2fcf23487096fb4703082bd

URL: https://github.com/llvm/llvm-project/commit/f39000b4505bcfe3d2fcf23487096fb4703082bd
DIFF: https://github.com/llvm/llvm-project/commit/f39000b4505bcfe3d2fcf23487096fb4703082bd.diff

LOG: [Driver] Delete CC1 -fxray-function-index and clean up some tests

Added: 
    

Modified: 
    clang/include/clang/Driver/Options.td
    clang/include/clang/Driver/XRayArgs.h
    clang/lib/Driver/XRayArgs.cpp
    clang/test/Driver/XRay/xray-function-index-flags.cpp
    clang/test/Driver/XRay/xray-ignore-loops-flags.cpp
    clang/test/Driver/XRay/xray-instrumentation-bundles-flags.cpp

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 9ea0016d057b..86d89360610e 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -1280,12 +1280,8 @@ defm xray_always_emit_typedevents : OptInFFlag<"xray-always-emit-typedevents",
 
 defm xray_ignore_loops : OptInFFlag<"xray-ignore-loops",
   "Don't instrument functions with loops unless they also meet the minimum function size">;
-
-def fxray_function_index : Flag<["-"], "fxray-function-index">,
-  Group<f_Group>, Flags<[CC1Option]>;
-def fno_xray_function_index : Flag<["-"], "fno-xray-function-index">,
-  Group<f_Group>, Flags<[CC1Option]>,
-  HelpText<"Omit the xray index section to reduce binary size at the expense of single-function patching performance">;
+defm xray_function_index : OptOutFFlag<"xray-function-index", "",
+  "Omit function index section at the expense of single-function patching performance">;
 
 def fxray_link_deps : Flag<["-"], "fxray-link-deps">, Group<f_Group>,
   Flags<[CC1Option]>,

diff  --git a/clang/include/clang/Driver/XRayArgs.h b/clang/include/clang/Driver/XRayArgs.h
index 22ab5fd2d207..2f055e5c6d7d 100644
--- a/clang/include/clang/Driver/XRayArgs.h
+++ b/clang/include/clang/Driver/XRayArgs.h
@@ -31,7 +31,7 @@ class XRayArgs {
   bool XRayAlwaysEmitTypedEvents = false;
   bool XRayRT = true;
   bool XRayIgnoreLoops = false;
-  bool XRayOmitFunctionIndex = false;
+  bool XRayFunctionIndex;
 
 public:
   /// Parses the XRay arguments from an argument list.

diff  --git a/clang/lib/Driver/XRayArgs.cpp b/clang/lib/Driver/XRayArgs.cpp
index 44a5d0d18291..f00c3906df97 100644
--- a/clang/lib/Driver/XRayArgs.cpp
+++ b/clang/lib/Driver/XRayArgs.cpp
@@ -105,9 +105,8 @@ XRayArgs::XRayArgs(const ToolChain &TC, const ArgList &Args) {
                    options::OPT_fno_xray_ignore_loops, false))
     XRayIgnoreLoops = true;
 
-  if (!Args.hasFlag(options::OPT_fxray_function_index,
-                    options::OPT_fno_xray_function_index, true))
-    XRayOmitFunctionIndex = true;
+  XRayFunctionIndex = Args.hasFlag(options::OPT_fxray_function_index,
+                                   options::OPT_fno_xray_function_index, true);
 
   auto Bundles =
       Args.getAllArgValues(options::OPT_fxray_instrumentation_bundle);
@@ -208,7 +207,7 @@ void XRayArgs::addArgs(const ToolChain &TC, const ArgList &Args,
   if (XRayIgnoreLoops)
     CmdArgs.push_back("-fxray-ignore-loops");
 
-  if (XRayOmitFunctionIndex)
+  if (!XRayFunctionIndex)
     CmdArgs.push_back("-fno-xray-function-index");
 
   CmdArgs.push_back(Args.MakeArgString(Twine(XRayInstructionThresholdOption) +

diff  --git a/clang/test/Driver/XRay/xray-function-index-flags.cpp b/clang/test/Driver/XRay/xray-function-index-flags.cpp
index 8bb05cea709e..f0d1a8a8c737 100644
--- a/clang/test/Driver/XRay/xray-function-index-flags.cpp
+++ b/clang/test/Driver/XRay/xray-function-index-flags.cpp
@@ -2,19 +2,11 @@
 // options respect the -fno-xray-function-index flag we provide in the
 // invocation. The default should be to *include* the function index.
 //
-// RUN: %clang -fxray-instrument -fxray-function-index -target x86_64-linux- -### \
-// RUN:     -x c++ -std=c++11 -emit-llvm -c -o - %s 2>&1 \
-// RUN:     | FileCheck %s
+// RUN: %clang -### -fxray-instrument -target x86_64 -c %s 2>&1 | FileCheck %s
+// RUN: %clang -### -fxray-instrument -target x86_64 -fxray-function-index -c %s 2>&1 | FileCheck %s
+
 // CHECK-NOT:  -fno-xray-function-index
-//
-// RUN: %clang -fxray-instrument -target x86_64-linux- -### \
-// RUN:     -x c++ -std=c++11 -emit-llvm -c -o - %s 2>&1 \
-// RUN:     | FileCheck %s -check-prefix CHECK-DEFAULT
-// CHECK-DEFAULT-NOT:  -fno-xray-function-index
-//
-// RUN: %clang -fxray-instrument -fno-xray-function-index -target x86_64-linux- -### \
-// RUN:     -x c++ -std=c++11 -emit-llvm -c -o - %s 2>&1 \
-// RUN:     | FileCheck %s -check-prefix CHECK-DISABLED
+
+// RUN: %clang -### -fxray-instrument -target x86_64 -fno-xray-function-index -c %s 2>&1 | FileCheck %s --check-prefix=CHECK-DISABLED
+
 // CHECK-DISABLED:  -fno-xray-function-index
-//
-// REQUIRES: x86_64 || x86_64h

diff  --git a/clang/test/Driver/XRay/xray-ignore-loops-flags.cpp b/clang/test/Driver/XRay/xray-ignore-loops-flags.cpp
index 476786fc639a..2c6ddb8b5297 100644
--- a/clang/test/Driver/XRay/xray-ignore-loops-flags.cpp
+++ b/clang/test/Driver/XRay/xray-ignore-loops-flags.cpp
@@ -3,8 +3,7 @@
 // invocation.
 //
 // RUN: %clang -fxray-instrument -fxray-ignore-loops -target x86_64-linux- -### \
-// RUN:     -x c++ -std=c++11 -emit-llvm -c -o - %s 2>&1 \
-// RUN:     | FileCheck %s
+// RUN:   -x c++ -emit-llvm -c -o - %s 2>&1 | FileCheck %s
 // CHECK:  -fxray-ignore-loops
 //
 // REQUIRES: x86_64 || x86_64h

diff  --git a/clang/test/Driver/XRay/xray-instrumentation-bundles-flags.cpp b/clang/test/Driver/XRay/xray-instrumentation-bundles-flags.cpp
index b68dca235525..4d311cc7d86c 100644
--- a/clang/test/Driver/XRay/xray-instrumentation-bundles-flags.cpp
+++ b/clang/test/Driver/XRay/xray-instrumentation-bundles-flags.cpp
@@ -3,8 +3,7 @@
 // invocation.
 //
 // RUN: %clang -fxray-instrument -fxray-instrumentation-bundle=function -### \
-// RUN:     -x c++ -std=c++11 -emit-llvm -c -o - %s 2>&1 \
-// RUN:     | FileCheck %s
+// RUN:   -c -o - %s 2>&1 | FileCheck %s
 // CHECK:  -fxray-instrumentation-bundle=function
 //
 // REQUIRES: linux || freebsd


        


More information about the cfe-commits mailing list