[Driver] Delete CC1 -fxray-function-index and clean up some tests
authorFangrui Song <maskray@google.com>
Wed, 17 Jun 2020 19:59:02 +0000 (12:59 -0700)
committerFangrui Song <maskray@google.com>
Wed, 17 Jun 2020 20:00:22 +0000 (13:00 -0700)
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

index 9ea0016..86d8936 100644 (file)
@@ -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]>,
index 22ab5fd..2f055e5 100644 (file)
@@ -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.
index 44a5d0d..f00c390 100644 (file)
@@ -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) +
index 8bb05ce..f0d1a8a 100644 (file)
@@ -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
index 476786f..2c6ddb8 100644 (file)
@@ -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
index b68dca2..4d311cc 100644 (file)
@@ -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