[clang] d600ab3 - [Frontend] Delete some unneeded CC1 options

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 23 22:01:18 PST 2020


Author: Fangrui Song
Date: 2020-01-23T22:01:04-08:00
New Revision: d600ab3bb51268b660e1ed62478d4bfa41294f54

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

LOG: [Frontend] Delete some unneeded CC1 options

Added: 
    

Modified: 
    clang/include/clang/Driver/Options.td
    clang/lib/Driver/XRayArgs.cpp
    clang/lib/Frontend/CompilerInvocation.cpp
    clang/test/CodeGen/asan-globals-gc.cpp
    clang/test/CodeGen/function-sections.c
    clang/test/CodeGen/xray-attributes-noxray-supported.cpp

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 58cdbb95d05f..80d774e64ee0 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -1252,8 +1252,7 @@ def fcf_protection : Flag<["-"], "fcf-protection">, Group<f_Group>, Flags<[CoreO
 def fxray_instrument : Flag<["-"], "fxray-instrument">, Group<f_Group>,
   Flags<[CC1Option]>,
   HelpText<"Generate XRay instrumentation sleds on function entry and exit">;
-def fnoxray_instrument : Flag<["-"], "fno-xray-instrument">, Group<f_Group>,
-  Flags<[CC1Option]>;
+def fno_xray_instrument : Flag<["-"], "fno-xray-instrument">, Group<f_Group>;
 
 def fxray_instruction_threshold_EQ :
   JoinedOrSeparate<["-"], "fxray-instruction-threshold=">,
@@ -1283,14 +1282,12 @@ def fxray_modes :
 def fxray_always_emit_customevents : Flag<["-"], "fxray-always-emit-customevents">, Group<f_Group>,
   Flags<[CC1Option]>,
   HelpText<"Determine whether to always emit __xray_customevent(...) calls even if the function it appears in is not always instrumented.">;
-def fnoxray_always_emit_customevents : Flag<["-"], "fno-xray-always-emit-customevents">, Group<f_Group>,
-  Flags<[CC1Option]>;
+def fno_xray_always_emit_customevents : Flag<["-"], "fno-xray-always-emit-customevents">, Group<f_Group>;
 
 def fxray_always_emit_typedevents : Flag<["-"], "fxray-always-emit-typedevents">, Group<f_Group>,
   Flags<[CC1Option]>,
   HelpText<"Determine whether to always emit __xray_typedevent(...) calls even if the function it appears in is not always instrumented.">;
-def fnoxray_always_emit_typedevents : Flag<["-"], "fno-xray-always-emit-typedevents">, Group<f_Group>,
-  Flags<[CC1Option]>;
+def fno_xray_always_emit_typedevents : Flag<["-"], "fno-xray-always-emit-typedevents">, Group<f_Group>;
 
 def fxray_ignore_loops : Flag<["-"], "fxray-ignore-loops">, Group<f_Group>,
   Flags<[CC1Option]>,
@@ -1558,8 +1555,6 @@ def fno_rtti : Flag<["-"], "fno-rtti">, Group<f_Group>, Flags<[CC1Option]>,
 def fno_rtti_data : Flag<["-"], "fno-rtti-data">, Group<f_Group>, Flags<[CC1Option]>,
   HelpText<"Control emission of RTTI data">;
 def fno_short_enums : Flag<["-"], "fno-short-enums">, Group<f_Group>;
-def fno_show_column : Flag<["-"], "fno-show-column">, Group<f_Group>, Flags<[CC1Option]>,
-  HelpText<"Do not include column number on diagnostics">;
 def fno_show_source_location : Flag<["-"], "fno-show-source-location">, Group<f_Group>,
   Flags<[CC1Option]>, HelpText<"Do not include source location information with diagnostics">;
 def fdiagnostics_absolute_paths : Flag<["-"], "fdiagnostics-absolute-paths">, Group<f_Group>,
@@ -1585,8 +1580,6 @@ def fno_use_cxa_atexit : Flag<["-"], "fno-use-cxa-atexit">, Group<f_Group>, Flag
   HelpText<"Don't use __cxa_atexit for calling destructors">;
 def fno_register_global_dtors_with_atexit : Flag<["-"], "fno-register-global-dtors-with-atexit">, Group<f_Group>,
   HelpText<"Don't use atexit or __cxa_atexit to register global destructors">;
-def fno_use_init_array : Flag<["-"], "fno-use-init-array">, Group<f_Group>, Flags<[CC1Option]>,
-  HelpText<"Don't use .init_array instead of .ctors">;
 def fno_unit_at_a_time : Flag<["-"], "fno-unit-at-a-time">, Group<f_Group>;
 def fno_unwind_tables : Flag<["-"], "fno-unwind-tables">, Group<f_Group>;
 def fno_verbose_asm : Flag<["-"], "fno-verbose-asm">, Group<f_Group>;
@@ -1759,7 +1752,9 @@ def fno_short_wchar : Flag<["-"], "fno-short-wchar">, Group<f_Group>,
 def fshow_overloads_EQ : Joined<["-"], "fshow-overloads=">, Group<f_Group>, Flags<[CC1Option]>,
   HelpText<"Which overload candidates to show when overload resolution fails: "
            "best|all; defaults to all">, Values<"best,all">;
-def fshow_column : Flag<["-"], "fshow-column">, Group<f_Group>, Flags<[CC1Option]>;
+def fshow_column : Flag<["-"], "fshow-column">, Group<f_Group>;
+def fno_show_column : Flag<["-"], "fno-show-column">, Group<f_Group>, Flags<[CC1Option]>,
+  HelpText<"Do not include column number on diagnostics">;
 def fshow_source_location : Flag<["-"], "fshow-source-location">, Group<f_Group>;
 def fspell_checking : Flag<["-"], "fspell-checking">, Group<f_Group>;
 def fspell_checking_limit_EQ : Joined<["-"], "fspell-checking-limit=">, Group<f_Group>;
@@ -1897,8 +1892,10 @@ def funwind_tables : Flag<["-"], "funwind-tables">, Group<f_Group>;
 def fuse_cxa_atexit : Flag<["-"], "fuse-cxa-atexit">, Group<f_Group>;
 def fregister_global_dtors_with_atexit : Flag<["-"], "fregister-global-dtors-with-atexit">, Group<f_Group>, Flags<[CC1Option]>,
   HelpText<"Use atexit or __cxa_atexit to register global destructors">;
-def fuse_init_array : Flag<["-"], "fuse-init-array">, Group<f_Group>, Flags<[CC1Option]>,
+def fuse_init_array : Flag<["-"], "fuse-init-array">, Group<f_Group>,
   HelpText<"Use .init_array instead of .ctors">;
+def fno_use_init_array : Flag<["-"], "fno-use-init-array">, Group<f_Group>, Flags<[CC1Option]>,
+  HelpText<"Don't use .init_array instead of .ctors">;
 def fno_var_tracking : Flag<["-"], "fno-var-tracking">, Group<clang_ignored_f_Group>;
 def fverbose_asm : Flag<["-"], "fverbose-asm">, Group<f_Group>;
 def dA : Flag<["-"], "dA">, Alias<fverbose_asm>;
@@ -1942,19 +1939,17 @@ def fzero_initialized_in_bss : Flag<["-"], "fzero-initialized-in-bss">, Group<f_
 def ffunction_sections : Flag<["-"], "ffunction-sections">, Group<f_Group>,
   Flags<[CC1Option]>,
   HelpText<"Place each function in its own section (ELF Only)">;
-def fno_function_sections : Flag<["-"], "fno-function-sections">,
-  Group<f_Group>, Flags<[CC1Option]>;
+def fno_function_sections : Flag<["-"], "fno-function-sections">, Group<f_Group>;
 def fdata_sections : Flag <["-"], "fdata-sections">, Group<f_Group>,
  Flags<[CC1Option]>, HelpText<"Place each data in its own section (ELF Only)">;
-def fno_data_sections : Flag <["-"], "fno-data-sections">, Group<f_Group>,
-  Flags<[CC1Option]>;
+def fno_data_sections : Flag <["-"], "fno-data-sections">, Group<f_Group>;
 def fstack_size_section : Flag<["-"], "fstack-size-section">, Group<f_Group>, Flags<[CC1Option]>,
   HelpText<"Emit section containing metadata on function stack sizes">;
-def fno_stack_size_section : Flag<["-"], "fno-stack-size-section">, Group<f_Group>, Flags<[CC1Option]>,
+def fno_stack_size_section : Flag<["-"], "fno-stack-size-section">, Group<f_Group>,
   HelpText<"Don't emit section containing metadata on function stack sizes">;
 
 def funique_section_names : Flag <["-"], "funique-section-names">,
-  Group<f_Group>, Flags<[CC1Option]>,
+  Group<f_Group>,
   HelpText<"Use unique names for text and data sections (ELF Only)">;
 def fno_unique_section_names : Flag <["-"], "fno-unique-section-names">,
   Group<f_Group>, Flags<[CC1Option]>;

diff  --git a/clang/lib/Driver/XRayArgs.cpp b/clang/lib/Driver/XRayArgs.cpp
index 07ed26b71817..e62b1f1a275d 100644
--- a/clang/lib/Driver/XRayArgs.cpp
+++ b/clang/lib/Driver/XRayArgs.cpp
@@ -32,158 +32,156 @@ constexpr const char *const XRaySupportedModes[] = {"xray-fdr", "xray-basic"};
 XRayArgs::XRayArgs(const ToolChain &TC, const ArgList &Args) {
   const Driver &D = TC.getDriver();
   const llvm::Triple &Triple = TC.getTriple();
-  if (Args.hasFlag(options::OPT_fxray_instrument,
-                   options::OPT_fnoxray_instrument, false)) {
-    if (Triple.getOS() == llvm::Triple::Linux) {
-      switch (Triple.getArch()) {
-      case llvm::Triple::x86_64:
-      case llvm::Triple::arm:
-      case llvm::Triple::aarch64:
-      case llvm::Triple::ppc64le:
-      case llvm::Triple::mips:
-      case llvm::Triple::mipsel:
-      case llvm::Triple::mips64:
-      case llvm::Triple::mips64el:
-        break;
-      default:
-        D.Diag(diag::err_drv_clang_unsupported)
-            << (std::string(XRayInstrumentOption) + " on " + Triple.str());
-      }
-    } else if (Triple.isOSFreeBSD() ||
-               Triple.isOSOpenBSD() ||
-               Triple.isOSNetBSD() ||
-               Triple.isMacOSX()) {
-      if (Triple.getArch() != llvm::Triple::x86_64) {
-        D.Diag(diag::err_drv_clang_unsupported)
-            << (std::string(XRayInstrumentOption) + " on " + Triple.str());
-      }
-    } else if (Triple.getOS() == llvm::Triple::Fuchsia) {
-      switch (Triple.getArch()) {
-      case llvm::Triple::x86_64:
-      case llvm::Triple::aarch64:
-        break;
-      default:
-        D.Diag(diag::err_drv_clang_unsupported)
-            << (std::string(XRayInstrumentOption) + " on " + Triple.str());
-      }
-    } else {
+  if (!Args.hasFlag(options::OPT_fxray_instrument,
+                    options::OPT_fno_xray_instrument, false))
+    return;
+  if (Triple.getOS() == llvm::Triple::Linux) {
+    switch (Triple.getArch()) {
+    case llvm::Triple::x86_64:
+    case llvm::Triple::arm:
+    case llvm::Triple::aarch64:
+    case llvm::Triple::ppc64le:
+    case llvm::Triple::mips:
+    case llvm::Triple::mipsel:
+    case llvm::Triple::mips64:
+    case llvm::Triple::mips64el:
+      break;
+    default:
       D.Diag(diag::err_drv_clang_unsupported)
           << (std::string(XRayInstrumentOption) + " on " + Triple.str());
     }
-
-    // Both XRay and -fpatchable-function-entry use
-    // TargetOpcode::PATCHABLE_FUNCTION_ENTER.
-    if (Arg *A = Args.getLastArg(options::OPT_fpatchable_function_entry_EQ))
-      D.Diag(diag::err_drv_argument_not_allowed_with)
-          << "-fxray-instrument" << A->getSpelling();
-
-    XRayInstrument = true;
-    if (const Arg *A =
-            Args.getLastArg(options::OPT_fxray_instruction_threshold_,
-                            options::OPT_fxray_instruction_threshold_EQ)) {
-      StringRef S = A->getValue();
-      if (S.getAsInteger(0, InstructionThreshold) || InstructionThreshold < 0)
-        D.Diag(clang::diag::err_drv_invalid_value) << A->getAsString(Args) << S;
+  } else if (Triple.isOSFreeBSD() || Triple.isOSOpenBSD() ||
+             Triple.isOSNetBSD() || Triple.isMacOSX()) {
+    if (Triple.getArch() != llvm::Triple::x86_64) {
+      D.Diag(diag::err_drv_clang_unsupported)
+          << (std::string(XRayInstrumentOption) + " on " + Triple.str());
     }
+  } else if (Triple.getOS() == llvm::Triple::Fuchsia) {
+    switch (Triple.getArch()) {
+    case llvm::Triple::x86_64:
+    case llvm::Triple::aarch64:
+      break;
+    default:
+      D.Diag(diag::err_drv_clang_unsupported)
+          << (std::string(XRayInstrumentOption) + " on " + Triple.str());
+    }
+  } else {
+    D.Diag(diag::err_drv_clang_unsupported)
+        << (std::string(XRayInstrumentOption) + " on " + Triple.str());
+  }
 
-    // By default, the back-end will not emit the lowering for XRay customevent
-    // calls if the function is not instrumented. In the future we will change
-    // this default to be the reverse, but in the meantime we're going to
-    // introduce the new functionality behind a flag.
-    if (Args.hasFlag(options::OPT_fxray_always_emit_customevents,
-                     options::OPT_fnoxray_always_emit_customevents, false))
-      XRayAlwaysEmitCustomEvents = true;
-
-    if (Args.hasFlag(options::OPT_fxray_always_emit_typedevents,
-                     options::OPT_fnoxray_always_emit_typedevents, false))
-      XRayAlwaysEmitTypedEvents = true;
-
-    if (!Args.hasFlag(options::OPT_fxray_link_deps,
-                      options::OPT_fnoxray_link_deps, true))
-      XRayRT = false;
-
-    auto Bundles =
-        Args.getAllArgValues(options::OPT_fxray_instrumentation_bundle);
-    if (Bundles.empty())
-      InstrumentationBundle.Mask = XRayInstrKind::All;
-    else
-      for (const auto &B : Bundles) {
-        llvm::SmallVector<StringRef, 2> BundleParts;
-        llvm::SplitString(B, BundleParts, ",");
-        for (const auto &P : BundleParts) {
-          // TODO: Automate the generation of the string case table.
-          auto Valid = llvm::StringSwitch<bool>(P)
-                           .Cases("none", "all", "function", "function-entry",
-                                  "function-exit", "custom", true)
-                           .Default(false);
-
-          if (!Valid) {
-            D.Diag(clang::diag::err_drv_invalid_value)
-                << "-fxray-instrumentation-bundle=" << P;
-            continue;
-          }
-
-          auto Mask = parseXRayInstrValue(P);
-          if (Mask == XRayInstrKind::None) {
-            InstrumentationBundle.clear();
-            break;
-          }
-
-          InstrumentationBundle.Mask |= Mask;
+  // Both XRay and -fpatchable-function-entry use
+  // TargetOpcode::PATCHABLE_FUNCTION_ENTER.
+  if (Arg *A = Args.getLastArg(options::OPT_fpatchable_function_entry_EQ))
+    D.Diag(diag::err_drv_argument_not_allowed_with)
+        << "-fxray-instrument" << A->getSpelling();
+
+  XRayInstrument = true;
+  if (const Arg *A =
+          Args.getLastArg(options::OPT_fxray_instruction_threshold_,
+                          options::OPT_fxray_instruction_threshold_EQ)) {
+    StringRef S = A->getValue();
+    if (S.getAsInteger(0, InstructionThreshold) || InstructionThreshold < 0)
+      D.Diag(clang::diag::err_drv_invalid_value) << A->getAsString(Args) << S;
+  }
+
+  // By default, the back-end will not emit the lowering for XRay customevent
+  // calls if the function is not instrumented. In the future we will change
+  // this default to be the reverse, but in the meantime we're going to
+  // introduce the new functionality behind a flag.
+  if (Args.hasFlag(options::OPT_fxray_always_emit_customevents,
+                   options::OPT_fno_xray_always_emit_customevents, false))
+    XRayAlwaysEmitCustomEvents = true;
+
+  if (Args.hasFlag(options::OPT_fxray_always_emit_typedevents,
+                   options::OPT_fno_xray_always_emit_typedevents, false))
+    XRayAlwaysEmitTypedEvents = true;
+
+  if (!Args.hasFlag(options::OPT_fxray_link_deps,
+                    options::OPT_fnoxray_link_deps, true))
+    XRayRT = false;
+
+  auto Bundles =
+      Args.getAllArgValues(options::OPT_fxray_instrumentation_bundle);
+  if (Bundles.empty())
+    InstrumentationBundle.Mask = XRayInstrKind::All;
+  else
+    for (const auto &B : Bundles) {
+      llvm::SmallVector<StringRef, 2> BundleParts;
+      llvm::SplitString(B, BundleParts, ",");
+      for (const auto &P : BundleParts) {
+        // TODO: Automate the generation of the string case table.
+        auto Valid = llvm::StringSwitch<bool>(P)
+                         .Cases("none", "all", "function", "function-entry",
+                                "function-exit", "custom", true)
+                         .Default(false);
+
+        if (!Valid) {
+          D.Diag(clang::diag::err_drv_invalid_value)
+              << "-fxray-instrumentation-bundle=" << P;
+          continue;
         }
-      }
 
-    // Validate the always/never attribute files. We also make sure that they
-    // are treated as actual dependencies.
-    for (const auto &Filename :
-         Args.getAllArgValues(options::OPT_fxray_always_instrument)) {
-      if (D.getVFS().exists(Filename)) {
-        AlwaysInstrumentFiles.push_back(Filename);
-        ExtraDeps.push_back(Filename);
-      } else
-        D.Diag(clang::diag::err_drv_no_such_file) << Filename;
-    }
+        auto Mask = parseXRayInstrValue(P);
+        if (Mask == XRayInstrKind::None) {
+          InstrumentationBundle.clear();
+          break;
+        }
 
-    for (const auto &Filename :
-         Args.getAllArgValues(options::OPT_fxray_never_instrument)) {
-      if (D.getVFS().exists(Filename)) {
-        NeverInstrumentFiles.push_back(Filename);
-        ExtraDeps.push_back(Filename);
-      } else
-        D.Diag(clang::diag::err_drv_no_such_file) << Filename;
+        InstrumentationBundle.Mask |= Mask;
+      }
     }
 
-    for (const auto &Filename :
-         Args.getAllArgValues(options::OPT_fxray_attr_list)) {
-      if (D.getVFS().exists(Filename)) {
-        AttrListFiles.push_back(Filename);
-        ExtraDeps.push_back(Filename);
-      } else
-        D.Diag(clang::diag::err_drv_no_such_file) << Filename;
-    }
+  // Validate the always/never attribute files. We also make sure that they
+  // are treated as actual dependencies.
+  for (const auto &Filename :
+       Args.getAllArgValues(options::OPT_fxray_always_instrument)) {
+    if (D.getVFS().exists(Filename)) {
+      AlwaysInstrumentFiles.push_back(Filename);
+      ExtraDeps.push_back(Filename);
+    } else
+      D.Diag(clang::diag::err_drv_no_such_file) << Filename;
+  }
 
-    // Get the list of modes we want to support.
-    auto SpecifiedModes = Args.getAllArgValues(options::OPT_fxray_modes);
-    if (SpecifiedModes.empty())
-      llvm::copy(XRaySupportedModes, std::back_inserter(Modes));
-    else
-      for (const auto &Arg : SpecifiedModes) {
-        // Parse CSV values for -fxray-modes=...
-        llvm::SmallVector<StringRef, 2> ModeParts;
-        llvm::SplitString(Arg, ModeParts, ",");
-        for (const auto &M : ModeParts)
-          if (M == "none")
-            Modes.clear();
-          else if (M == "all")
-            llvm::copy(XRaySupportedModes, std::back_inserter(Modes));
-          else
-            Modes.push_back(M);
-      }
+  for (const auto &Filename :
+       Args.getAllArgValues(options::OPT_fxray_never_instrument)) {
+    if (D.getVFS().exists(Filename)) {
+      NeverInstrumentFiles.push_back(Filename);
+      ExtraDeps.push_back(Filename);
+    } else
+      D.Diag(clang::diag::err_drv_no_such_file) << Filename;
+  }
 
-    // Then we want to sort and unique the modes we've collected.
-    llvm::sort(Modes);
-    Modes.erase(std::unique(Modes.begin(), Modes.end()), Modes.end());
+  for (const auto &Filename :
+       Args.getAllArgValues(options::OPT_fxray_attr_list)) {
+    if (D.getVFS().exists(Filename)) {
+      AttrListFiles.push_back(Filename);
+      ExtraDeps.push_back(Filename);
+    } else
+      D.Diag(clang::diag::err_drv_no_such_file) << Filename;
   }
+
+  // Get the list of modes we want to support.
+  auto SpecifiedModes = Args.getAllArgValues(options::OPT_fxray_modes);
+  if (SpecifiedModes.empty())
+    llvm::copy(XRaySupportedModes, std::back_inserter(Modes));
+  else
+    for (const auto &Arg : SpecifiedModes) {
+      // Parse CSV values for -fxray-modes=...
+      llvm::SmallVector<StringRef, 2> ModeParts;
+      llvm::SplitString(Arg, ModeParts, ",");
+      for (const auto &M : ModeParts)
+        if (M == "none")
+          Modes.clear();
+        else if (M == "all")
+          llvm::copy(XRaySupportedModes, std::back_inserter(Modes));
+        else
+          Modes.push_back(M);
+    }
+
+  // Then we want to sort and unique the modes we've collected.
+  llvm::sort(Modes);
+  Modes.erase(std::unique(Modes.begin(), Modes.end()), Modes.end());
 }
 
 void XRayArgs::addArgs(const ToolChain &TC, const ArgList &Args,

diff  --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 40bcc95d409f..847b613d6e94 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -952,14 +952,10 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
   Opts.TrapFuncName = Args.getLastArgValue(OPT_ftrap_function_EQ);
   Opts.UseInitArray = !Args.hasArg(OPT_fno_use_init_array);
 
-  Opts.FunctionSections = Args.hasFlag(OPT_ffunction_sections,
-                                       OPT_fno_function_sections, false);
-  Opts.DataSections = Args.hasFlag(OPT_fdata_sections,
-                                   OPT_fno_data_sections, false);
-  Opts.StackSizeSection =
-      Args.hasFlag(OPT_fstack_size_section, OPT_fno_stack_size_section, false);
-  Opts.UniqueSectionNames = Args.hasFlag(OPT_funique_section_names,
-                                         OPT_fno_unique_section_names, true);
+  Opts.FunctionSections = Args.hasArg(OPT_ffunction_sections);
+  Opts.DataSections = Args.hasArg(OPT_fdata_sections);
+  Opts.StackSizeSection = Args.hasArg(OPT_fstack_size_section);
+  Opts.UniqueSectionNames = !Args.hasArg(OPT_fno_unique_section_names);
 
   Opts.MergeFunctions = Args.hasArg(OPT_fmerge_functions);
 
@@ -1552,9 +1548,7 @@ bool clang::ParseDiagnosticArgs(DiagnosticOptions &Opts, ArgList &Args,
   Opts.PedanticErrors = Args.hasArg(OPT_pedantic_errors);
   Opts.ShowCarets = !Args.hasArg(OPT_fno_caret_diagnostics);
   Opts.ShowColors = parseShowColorsArgs(Args, DefaultDiagColor);
-  Opts.ShowColumn = Args.hasFlag(OPT_fshow_column,
-                                 OPT_fno_show_column,
-                                 /*Default=*/true);
+  Opts.ShowColumn = !Args.hasArg(OPT_fno_show_column);
   Opts.ShowFixits = !Args.hasArg(OPT_fno_diagnostics_fixit_info);
   Opts.ShowLocation = !Args.hasArg(OPT_fno_show_source_location);
   Opts.AbsolutePath = Args.hasArg(OPT_fdiagnostics_absolute_paths);
@@ -3242,18 +3236,11 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
                                       systemBlacklists.end());
 
   // -fxray-instrument
-  Opts.XRayInstrument =
-      Args.hasFlag(OPT_fxray_instrument, OPT_fnoxray_instrument, false);
-
-  // -fxray-always-emit-customevents
+  Opts.XRayInstrument = Args.hasArg(OPT_fxray_instrument);
   Opts.XRayAlwaysEmitCustomEvents =
-      Args.hasFlag(OPT_fxray_always_emit_customevents,
-                   OPT_fnoxray_always_emit_customevents, false);
-
-  // -fxray-always-emit-typedevents
+      Args.hasArg(OPT_fxray_always_emit_customevents);
   Opts.XRayAlwaysEmitTypedEvents =
-      Args.hasFlag(OPT_fxray_always_emit_typedevents,
-                   OPT_fnoxray_always_emit_customevents, false);
+      Args.hasArg(OPT_fxray_always_emit_typedevents);
 
   // -fxray-{always,never}-instrument= filenames.
   Opts.XRayAlwaysInstrumentFiles =

diff  --git a/clang/test/CodeGen/asan-globals-gc.cpp b/clang/test/CodeGen/asan-globals-gc.cpp
index 58ce5f067563..95702516d8a1 100644
--- a/clang/test/CodeGen/asan-globals-gc.cpp
+++ b/clang/test/CodeGen/asan-globals-gc.cpp
@@ -4,11 +4,11 @@
 // RUN: %clang_cc1 -fsanitize=address -fsanitize-address-globals-dead-stripping -fno-integrated-as -emit-llvm -o - -triple x86_64-linux %s | FileCheck %s --check-prefix=WITHOUT-GC
 // RUN: %clang_cc1 -fsanitize=address -fdata-sections -emit-llvm -o - -triple x86_64-linux %s | FileCheck %s --check-prefix=WITHOUT-GC
 
-// RUN: %clang_cc1 -fsanitize=address -fsanitize-address-globals-dead-stripping -fno-data-sections -emit-llvm -o - -triple x86_64-windows-msvc %s | FileCheck %s --check-prefix=WITH-GC
+// RUN: %clang_cc1 -fsanitize=address -fsanitize-address-globals-dead-stripping -emit-llvm -o - -triple x86_64-windows-msvc %s | FileCheck %s --check-prefix=WITH-GC
 // RUN: %clang_cc1 -fsanitize=address -fsanitize-address-globals-dead-stripping -fdata-sections -emit-llvm -o - -triple x86_64-windows-msvc %s | FileCheck %s --check-prefix=WITH-GC
 // RUN: %clang_cc1 -fsanitize=address -fdata-sections -emit-llvm -o - -triple x86_64-windows-msvc %s | FileCheck %s --check-prefix=WITHOUT-GC
 
-// RUN: %clang_cc1 -fsanitize=address -fsanitize-address-globals-dead-stripping -fno-data-sections -emit-llvm -o - -triple x86_64-apple-macosx11 %s | FileCheck %s --check-prefix=WITH-GC
+// RUN: %clang_cc1 -fsanitize=address -fsanitize-address-globals-dead-stripping -emit-llvm -o - -triple x86_64-apple-macosx11 %s | FileCheck %s --check-prefix=WITH-GC
 // RUN: %clang_cc1 -fsanitize=address -fsanitize-address-globals-dead-stripping -fdata-sections -emit-llvm -o - -triple x86_64-apple-macosx11 %s | FileCheck %s --check-prefix=WITH-GC
 // RUN: %clang_cc1 -fsanitize=address -fdata-sections -emit-llvm -o - -triple x86_64-apple-macosx11 %s | FileCheck %s --check-prefix=WITHOUT-GC
 

diff  --git a/clang/test/CodeGen/function-sections.c b/clang/test/CodeGen/function-sections.c
index c34216dec6c7..60921cb4bada 100644
--- a/clang/test/CodeGen/function-sections.c
+++ b/clang/test/CodeGen/function-sections.c
@@ -1,13 +1,9 @@
 // REQUIRES: x86-registered-target
 
 // RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -S -o - < %s | FileCheck %s --check-prefix=PLAIN
-// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -S -ffunction-sections -fno-function-sections -o - < %s | FileCheck %s --check-prefix=PLAIN
-
 // RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -S -ffunction-sections -o - < %s | FileCheck %s --check-prefix=FUNC_SECT
-// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -S -fno-function-sections -ffunction-sections -o - < %s | FileCheck %s --check-prefix=FUNC_SECT
 
 // RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -S -fdata-sections -o - < %s | FileCheck %s --check-prefix=DATA_SECT
-// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -S -fno-data-sections -fdata-sections -o - < %s | FileCheck %s --check-prefix=DATA_SECT
 
 // Try again through a clang invocation of the ThinLTO backend.
 // RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -O2 %s -flto=thin -emit-llvm-bc -o %t.o

diff  --git a/clang/test/CodeGen/xray-attributes-noxray-supported.cpp b/clang/test/CodeGen/xray-attributes-noxray-supported.cpp
index f9c8a2ee6927..ca5881fba380 100644
--- a/clang/test/CodeGen/xray-attributes-noxray-supported.cpp
+++ b/clang/test/CodeGen/xray-attributes-noxray-supported.cpp
@@ -1,19 +1,20 @@
 // We want to ensure that the "never instrument" attributes show up even if we
 // explicitly turn off XRay instrumentation.
 //
-// RUN: %clang_cc1 %s -fno-xray-instrument -std=c++11 -x c++ -emit-llvm -o - \
+/// -fno-xray-instrument is the default. It does not produce a CC1 option.
+// RUN: %clang_cc1 %s -std=c++11 -x c++ -emit-llvm -o - \
 // RUN:     -triple x86_64-unknown-linux-gnu | FileCheck %s
-// RUN: %clang_cc1 %s -fno-xray-instrument -std=c++11 -x c++ -emit-llvm -o - \
+// RUN: %clang_cc1 %s -std=c++11 -x c++ -emit-llvm -o - \
 // RUN:     -triple arm-unknown-linux-gnu -target-abi apcs-gnu | FileCheck %s
-// RUN: %clang_cc1 %s -fno-xray-instrument -std=c++11 -x c++ -emit-llvm -o - \
+// RUN: %clang_cc1 %s -std=c++11 -x c++ -emit-llvm -o - \
 // RUN:     -triple mips-unknown-linux-gnu | FileCheck %s
-// RUN: %clang_cc1 %s -fno-xray-instrument -std=c++11 -x c++ -emit-llvm -o - \
+// RUN: %clang_cc1 %s -std=c++11 -x c++ -emit-llvm -o - \
 // RUN:     -triple mipsel-unknown-linux-gnu | FileCheck %s
-// RUN: %clang_cc1 %s -fno-xray-instrument -std=c++11 -x c++ -emit-llvm -o - \
+// RUN: %clang_cc1 %s -std=c++11 -x c++ -emit-llvm -o - \
 // RUN:     -triple mips64-unknown-linux-gnu | FileCheck %s
-// RUN: %clang_cc1 %s -fno-xray-instrument -std=c++11 -x c++ -emit-llvm -o - \
+// RUN: %clang_cc1 %s -std=c++11 -x c++ -emit-llvm -o - \
 // RUN:     -triple mips64el-unknown-linux-gnu | FileCheck %s
-// RUN: %clang_cc1 %s -fno-xray-instrument -std=c++11 -x c++ -emit-llvm -o - \
+// RUN: %clang_cc1 %s -std=c++11 -x c++ -emit-llvm -o - \
 // RUN:     -triple powerpc64le-unknown-linux-gnu | FileCheck %s
 
 [[clang::xray_always_instrument]] void foo() {


        


More information about the cfe-commits mailing list