[clang] 1157bee - Revert "[clang][modules] Reset codegen options. (#74006)"

Juergen Ributzka via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 4 14:28:43 PST 2023


Author: Juergen Ributzka
Date: 2023-12-04T14:28:22-08:00
New Revision: 1157bee5ce2c7acb803cda5003b2ea9d0ed962e2

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

LOG: Revert "[clang][modules] Reset codegen options. (#74006)"

This reverts commit fef1854318bd797c1f8a141d4b45b113b04860d1.

Added: 
    

Modified: 
    clang/include/clang/Basic/CodeGenOptions.def
    clang/include/clang/Basic/CodeGenOptions.h
    clang/include/module.modulemap
    clang/lib/Basic/CodeGenOptions.cpp
    clang/lib/Frontend/CompilerInvocation.cpp

Removed: 
    clang/include/clang/Basic/DebugOptions.def
    clang/test/ClangScanDeps/strip-codegen-args.m


################################################################################
diff  --git a/clang/include/clang/Basic/CodeGenOptions.def b/clang/include/clang/Basic/CodeGenOptions.def
index 0acb5ae134ea2..675645cd534ed 100644
--- a/clang/include/clang/Basic/CodeGenOptions.def
+++ b/clang/include/clang/Basic/CodeGenOptions.def
@@ -28,8 +28,12 @@ CODEGENOPT(Name, Bits, Default)
 #endif
 
 CODEGENOPT(DisableIntegratedAS, 1, 0) ///< -no-integrated-as
+ENUM_CODEGENOPT(CompressDebugSections, llvm::DebugCompressionType, 2,
+                llvm::DebugCompressionType::None)
 CODEGENOPT(RelaxELFRelocations, 1, 1) ///< -Wa,-mrelax-relocations={yes,no}
 CODEGENOPT(AsmVerbose        , 1, 0) ///< -dA, -fverbose-asm.
+CODEGENOPT(Dwarf64           , 1, 0) ///< -gdwarf64.
+CODEGENOPT(Dwarf32           , 1, 1) ///< -gdwarf32.
 CODEGENOPT(PreserveAsmComments, 1, 1) ///< -dA, -fno-preserve-as-comments.
 CODEGENOPT(AssumeSaneOperatorNew , 1, 1) ///< implicit __attribute__((malloc)) operator new
 CODEGENOPT(AssumeUniqueVTables , 1, 1) ///< Assume a class has only one vtable.
@@ -69,6 +73,10 @@ CODEGENOPT(DebugPassManager, 1, 0) ///< Prints debug information for the new
 CODEGENOPT(DisableRedZone    , 1, 0) ///< Set when -mno-red-zone is enabled.
 CODEGENOPT(EmitCallSiteInfo, 1, 0) ///< Emit call site info only in the case of
                                    ///< '-g' + 'O>0' level.
+CODEGENOPT(EnableDIPreservationVerify, 1, 0) ///< Enable di preservation verify
+                                             ///< each (it means check
+                                             ///< the original debug info
+                                             ///< metadata preservation).
 CODEGENOPT(IndirectTlsSegRefs, 1, 0) ///< Set when -mno-tls-direct-seg-refs
                                      ///< is specified.
 CODEGENOPT(DisableTailCalls  , 1, 0) ///< Do not emit tail calls.
@@ -105,10 +113,16 @@ CODEGENOPT(IndirectBranchCSPrefix, 1, 0) ///< if -mindirect-branch-cs-prefix
 CODEGENOPT(XRayInstrumentFunctions , 1, 0) ///< Set when -fxray-instrument is
                                            ///< enabled.
 CODEGENOPT(StackSizeSection  , 1, 0) ///< Set when -fstack-size-section is enabled.
+CODEGENOPT(ForceDwarfFrameSection , 1, 0) ///< Set when -fforce-dwarf-frame is
+                                          ///< enabled.
 
 ///< Set when -femit-compact-unwind-non-canonical is enabled.
 CODEGENOPT(EmitCompactUnwindNonCanonical, 1, 0)
 
+///< Set when -femit-dwarf-unwind is passed.
+ENUM_CODEGENOPT(EmitDwarfUnwind, llvm::EmitDwarfUnwindType, 2,
+                llvm::EmitDwarfUnwindType::Default)
+
 ///< Set when -fxray-always-emit-customevents is enabled.
 CODEGENOPT(XRayAlwaysEmitCustomEvents , 1, 0)
 
@@ -164,6 +178,8 @@ CODEGENOPT(IncrementalLinkerCompatible, 1, 0) ///< Emit an object file which can
 CODEGENOPT(MergeAllConstants , 1, 1) ///< Merge identical constants.
 CODEGENOPT(MergeFunctions    , 1, 0) ///< Set when -fmerge-functions is enabled.
 CODEGENOPT(NoCommon          , 1, 0) ///< Set when -fno-common or C++ is enabled.
+CODEGENOPT(NoDwarfDirectoryAsm , 1, 0) ///< Set when -fno-dwarf-directory-asm is
+                                       ///< enabled.
 CODEGENOPT(NoExecStack       , 1, 0) ///< Set when -Wa,--noexecstack is enabled.
 CODEGENOPT(FatalWarnings     , 1, 0) ///< Set when -Wa,--fatal-warnings is
                                      ///< enabled.
@@ -171,6 +187,8 @@ CODEGENOPT(NoWarn            , 1, 0) ///< Set when -Wa,--no-warn is enabled.
 CODEGENOPT(NoTypeCheck       , 1, 0) ///< Set when -Wa,--no-type-check is enabled.
 CODEGENOPT(MisExpect         , 1, 0) ///< Set when -Wmisexpect is enabled
 CODEGENOPT(EnableSegmentedStacks , 1, 0) ///< Set when -fsplit-stack is enabled.
+CODEGENOPT(NoInlineLineTables, 1, 0) ///< Whether debug info should contain
+                                     ///< inline line tables.
 CODEGENOPT(StackClashProtector, 1, 0) ///< Set when -fstack-clash-protection is enabled.
 CODEGENOPT(NoImplicitFloat   , 1, 0) ///< Set when -mno-implicit-float is enabled.
 CODEGENOPT(NullPointerIsValid , 1, 0) ///< Assume Null pointer deference is defined.
@@ -323,6 +341,37 @@ VALUE_CODEGENOPT(StackProbeSize    , 32, 4096) ///< Overrides default stack
                                                ///< probe size, even if 0.
 VALUE_CODEGENOPT(WarnStackSize     , 32, UINT_MAX) ///< Set via -fwarn-stack-size.
 CODEGENOPT(NoStackArgProbe, 1, 0) ///< Set when -mno-stack-arg-probe is used
+CODEGENOPT(DebugStrictDwarf, 1, 1) ///< Whether or not to use strict DWARF info.
+
+/// Control the Assignment Tracking debug info feature.
+ENUM_CODEGENOPT(AssignmentTrackingMode, AssignmentTrackingOpts, 2, AssignmentTrackingOpts::Disabled)
+
+CODEGENOPT(DebugColumnInfo, 1, 0) ///< Whether or not to use column information
+                                  ///< in debug info.
+
+CODEGENOPT(DebugTypeExtRefs, 1, 0) ///< Whether or not debug info should contain
+                                   ///< external references to a PCH or module.
+
+CODEGENOPT(DebugExplicitImport, 1, 0)  ///< Whether or not debug info should
+                                       ///< contain explicit imports for
+                                       ///< anonymous namespaces
+
+/// Set debug info source file hashing algorithm.
+ENUM_CODEGENOPT(DebugSrcHash, DebugSrcHashKind, 2, DSH_MD5)
+
+CODEGENOPT(SplitDwarfInlining, 1, 1) ///< Whether to include inlining info in the
+                                     ///< skeleton CU to allow for symbolication
+                                     ///< of inline stack frames without .dwo files.
+CODEGENOPT(DebugFwdTemplateParams, 1, 0) ///< Whether to emit complete
+                                         ///< template parameter descriptions in
+                                         ///< forward declarations (versus just
+                                         ///< including them in the name).
+ENUM_CODEGENOPT(DebugSimpleTemplateNames, llvm::codegenoptions::DebugTemplateNamesKind, 2, llvm::codegenoptions::DebugTemplateNamesKind::Full) ///< Whether to emit template parameters
+                                           ///< in the textual names of template
+					   ///< specializations.
+					   ///< Implies DebugFwdTemplateNames to
+					   ///< allow decorated names to be
+					   ///< reconstructed when needed.
 CODEGENOPT(EmitLLVMUseLists, 1, 0) ///< Control whether to serialize use-lists.
 
 CODEGENOPT(WholeProgramVTables, 1, 0) ///< Whether to apply whole-program
@@ -346,6 +395,30 @@ VALUE_CODEGENOPT(SmallDataLimit, 32, 0)
 /// The lower bound for a buffer to be considered for stack protection.
 VALUE_CODEGENOPT(SSPBufferSize, 32, 0)
 
+/// The kind of generated debug info.
+ENUM_CODEGENOPT(DebugInfo, llvm::codegenoptions::DebugInfoKind, 4, llvm::codegenoptions::NoDebugInfo)
+
+/// Whether to generate macro debug info.
+CODEGENOPT(MacroDebugInfo, 1, 0)
+
+/// Tune the debug info for this debugger.
+ENUM_CODEGENOPT(DebuggerTuning, llvm::DebuggerKind, 3,
+                llvm::DebuggerKind::Default)
+
+/// Dwarf version. Version zero indicates to LLVM that no DWARF should be
+/// emitted.
+VALUE_CODEGENOPT(DwarfVersion, 3, 0)
+
+/// Whether we should emit CodeView debug information. It's possible to emit
+/// CodeView and DWARF into the same object.
+CODEGENOPT(EmitCodeView, 1, 0)
+
+/// Whether to emit the .debug$H section containing hashes of CodeView types.
+CODEGENOPT(CodeViewGHash, 1, 0)
+
+/// Whether to emit the compiler path and command line into the CodeView debug information.
+CODEGENOPT(CodeViewCommandLine, 1, 0)
+
 /// The kind of inlining to perform.
 ENUM_CODEGENOPT(Inlining, InliningMethod, 2, NormalInlining)
 
@@ -378,14 +451,26 @@ CODEGENOPT(DirectAccessExternalData, 1, 0)
 /// paths that reach the end of a function without executing a required return.
 CODEGENOPT(StrictReturn, 1, 1)
 
+/// Whether emit extra debug info for sample pgo profile collection.
+CODEGENOPT(DebugInfoForProfiling, 1, 0)
+
 /// Whether emit pseudo probes for sample pgo profile collection.
 CODEGENOPT(PseudoProbeForProfiling, 1, 0)
 
 /// Whether 3-component vector type is preserved.
 CODEGENOPT(PreserveVec3Type, 1, 0)
 
+/// Whether to emit .debug_gnu_pubnames section instead of .debug_pubnames.
+CODEGENOPT(DebugNameTable, 2, 0)
+
+/// Whether to use DWARF base address specifiers in .debug_ranges.
+CODEGENOPT(DebugRangesBaseAddress, 1, 0)
+
 CODEGENOPT(NoPLT, 1, 0)
 
+/// Whether to embed source in DWARF debug line section.
+CODEGENOPT(EmbedSource, 1, 0)
+
 /// Whether to emit all vtables
 CODEGENOPT(ForceEmitVTables, 1, 0)
 
@@ -430,9 +515,6 @@ ENUM_CODEGENOPT(ZeroCallUsedRegs, llvm::ZeroCallUsedRegs::ZeroCallUsedRegsKind,
 /// non-deleting destructors. (No effect on Microsoft ABI.)
 CODEGENOPT(CtorDtorReturnThis, 1, 0)
 
-/// FIXME: Make DebugOptions its own top-level .def file.
-#include "DebugOptions.def"
-
 #undef CODEGENOPT
 #undef ENUM_CODEGENOPT
 #undef VALUE_CODEGENOPT

diff  --git a/clang/include/clang/Basic/CodeGenOptions.h b/clang/include/clang/Basic/CodeGenOptions.h
index 6952b48e898a8..b202d01af0ed6 100644
--- a/clang/include/clang/Basic/CodeGenOptions.h
+++ b/clang/include/clang/Basic/CodeGenOptions.h
@@ -530,10 +530,6 @@ class CodeGenOptions : public CodeGenOptionsBase {
     return SanitizeBinaryMetadataCovered || SanitizeBinaryMetadataAtomics ||
            SanitizeBinaryMetadataUAR;
   }
-
-  /// Reset all of the options that are not considered when building a
-  /// module.
-  void resetNonModularOptions(StringRef ModuleFormat);
 };
 
 }  // end namespace clang

diff  --git a/clang/include/clang/Basic/DebugOptions.def b/clang/include/clang/Basic/DebugOptions.def
deleted file mode 100644
index 7cd3edf08a17e..0000000000000
--- a/clang/include/clang/Basic/DebugOptions.def
+++ /dev/null
@@ -1,146 +0,0 @@
-//===--- DebugOptions.def - Debug option database ----------------- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines debug-specific codegen options. Users of this file
-// must define the CODEGENOPT macro to make use of this information.
-// Optionally, the user may also define DEBUGOPT (for flags), ENUM_DEBUGOPT (for
-// options that have enumeration type), and VALUE_DEBUGOPT (is a debug option
-// that describes a value rather than a flag).
-//
-// BENIGN_ variants of the macros are used to describe options that do not
-// affect the generated PCM.
-//
-//===----------------------------------------------------------------------===//
-#ifndef DEBUGOPT
-#define DEBUGOPT(Name, Bits, Default) \
-CODEGENOPT(Name, Bits, Default)
-#endif
-
-#ifndef VALUE_DEBUGOPT
-#  define VALUE_DEBUGOPT(Name, Bits, Default) \
-VALUE_CODEGENOPT(Name, Bits, Default)
-#endif
-
-#ifndef ENUM_DEBUGOPT
-#  define ENUM_DEBUGOPT(Name, Type, Bits, Default) \
-ENUM_CODEGENOPT(Name, Type, Bits, Default)
-#endif
-
-#ifndef BENIGN_DEBUGOPT
-#define BENIGN_DEBUGOPT(Name, Bits, Default) \
-DEBUGOPT(Name, Bits, Default)
-#endif
-
-#ifndef BENIGN_VALUE_DEBUGOPT
-#  define BENIGN_VALUE_DEBUGOPT(Name, Bits, Default) \
-VALUE_DEBUGOPT(Name, Bits, Default)
-#endif
-
-#ifndef BENIGN_ENUM_DEBUGOPT
-#  define BENIGN_ENUM_DEBUGOPT(Name, Type, Bits, Default) \
-ENUM_DEBUGOPT(Name, Type, Bits, Default)
-#endif
-
-BENIGN_ENUM_DEBUGOPT(CompressDebugSections, llvm::DebugCompressionType, 2,
-                     llvm::DebugCompressionType::None)
-DEBUGOPT(Dwarf64, 1, 0) ///< -gdwarf64.
-BENIGN_DEBUGOPT(EnableDIPreservationVerify, 1, 0) ///< Enable di preservation
-                                                  ///< verify each (it means
-                                                  ///< check the original debug
-                                                  ///< info metadata
-                                                  ///< preservation).
-BENIGN_DEBUGOPT(ForceDwarfFrameSection , 1, 0) ///< Set when -fforce-dwarf-frame
-                                               ///< is enabled.
-
-///< Set when -femit-dwarf-unwind is passed.
-BENIGN_ENUM_DEBUGOPT(EmitDwarfUnwind, llvm::EmitDwarfUnwindType, 2,
-                     llvm::EmitDwarfUnwindType::Default)
-
-BENIGN_DEBUGOPT(NoDwarfDirectoryAsm , 1, 0) ///< Set when -fno-dwarf-directory-asm
-                                            ///< is enabled.
-
-BENIGN_DEBUGOPT(NoInlineLineTables, 1, 0) ///< Whether debug info should contain
-                                          ///< inline line tables.
-
-DEBUGOPT(DebugStrictDwarf, 1, 1) ///< Whether or not to use strict DWARF info.
-
-/// Control the Assignment Tracking debug info feature.
-BENIGN_ENUM_DEBUGOPT(AssignmentTrackingMode, AssignmentTrackingOpts, 2,
-                     AssignmentTrackingOpts::Disabled)
-
-DEBUGOPT(DebugColumnInfo, 1, 0) ///< Whether or not to use column information
-                                ///< in debug info.
-
-DEBUGOPT(DebugTypeExtRefs, 1, 0) ///< Whether or not debug info should contain
-                                 ///< external references to a PCH or module.
-
-DEBUGOPT(DebugExplicitImport, 1, 0)  ///< Whether or not debug info should
-                                     ///< contain explicit imports for
-                                     ///< anonymous namespaces
-
-/// Set debug info source file hashing algorithm.
-ENUM_DEBUGOPT(DebugSrcHash, DebugSrcHashKind, 2, DSH_MD5)
-
-DEBUGOPT(SplitDwarfInlining, 1, 1) ///< Whether to include inlining info in the
-                                   ///< skeleton CU to allow for symbolication
-                                   ///< of inline stack frames without .dwo files.
-DEBUGOPT(DebugFwdTemplateParams, 1, 0) ///< Whether to emit complete
-                                       ///< template parameter descriptions in
-                                       ///< forward declarations (versus just
-                                       ///< including them in the name).
-ENUM_DEBUGOPT(DebugSimpleTemplateNames,
-              llvm::codegenoptions::DebugTemplateNamesKind, 2,
-              llvm::codegenoptions::DebugTemplateNamesKind::Full)
-              ///< Whether to emit template parameters in the textual names of
-              ///< template specializations.
-			  ///< Implies DebugFwdTemplateNames to allow decorated names to be
-			  ///< reconstructed when needed.
-
-/// The kind of generated debug info.
-ENUM_DEBUGOPT(DebugInfo, llvm::codegenoptions::DebugInfoKind, 4,
-              llvm::codegenoptions::NoDebugInfo)
-
-/// Whether to generate macro debug info.
-DEBUGOPT(MacroDebugInfo, 1, 0)
-
-/// Tune the debug info for this debugger.
-ENUM_DEBUGOPT(DebuggerTuning, llvm::DebuggerKind, 3,
-                llvm::DebuggerKind::Default)
-
-/// Dwarf version. Version zero indicates to LLVM that no DWARF should be
-/// emitted.
-VALUE_DEBUGOPT(DwarfVersion, 3, 0)
-
-/// Whether we should emit CodeView debug information. It's possible to emit
-/// CodeView and DWARF into the same object.
-DEBUGOPT(EmitCodeView, 1, 0)
-
-/// Whether to emit the .debug$H section containing hashes of CodeView types.
-DEBUGOPT(CodeViewGHash, 1, 0)
-
-/// Whether to emit the compiler path and command line into the CodeView debug information.
-DEBUGOPT(CodeViewCommandLine, 1, 0)
-
-/// Whether emit extra debug info for sample pgo profile collection.
-DEBUGOPT(DebugInfoForProfiling, 1, 0)
-
-/// Whether to emit .debug_gnu_pubnames section instead of .debug_pubnames.
-DEBUGOPT(DebugNameTable, 2, 0)
-
-/// Whether to use DWARF base address specifiers in .debug_ranges.
-DEBUGOPT(DebugRangesBaseAddress, 1, 0)
-
-/// Whether to embed source in DWARF debug line section.
-DEBUGOPT(EmbedSource, 1, 0)
-
-#undef DEBUGOPT
-#undef ENUM_DEBUGOPT
-#undef VALUE_DEBUGOPT
-#undef BENIGN_DEBUGOPT
-#undef BENIGN_ENUM_DEBUGOPT
-#undef BENIGN_VALUE_DEBUGOPT

diff  --git a/clang/include/module.modulemap b/clang/include/module.modulemap
index 52395ee9b0fc9..7dbb7cf02b4f8 100644
--- a/clang/include/module.modulemap
+++ b/clang/include/module.modulemap
@@ -68,7 +68,6 @@ module Clang_Basic {
   textual header "clang/Basic/BuiltinsX86_64.def"
   textual header "clang/Basic/BuiltinsXCore.def"
   textual header "clang/Basic/CodeGenOptions.def"
-  textual header "clang/Basic/DebugOptions.def"
   textual header "clang/Basic/DiagnosticOptions.def"
   textual header "clang/Basic/Features.def"
   textual header "clang/Basic/FPOptions.def"

diff  --git a/clang/lib/Basic/CodeGenOptions.cpp b/clang/lib/Basic/CodeGenOptions.cpp
index 1b9f67c9a0726..0c609cfa61de1 100644
--- a/clang/lib/Basic/CodeGenOptions.cpp
+++ b/clang/lib/Basic/CodeGenOptions.cpp
@@ -20,39 +20,4 @@ CodeGenOptions::CodeGenOptions() {
   memcpy(CoverageVersion, "408*", 4);
 }
 
-void CodeGenOptions::resetNonModularOptions(StringRef ModuleFormat) {
-  // First reset all CodeGen options only. The Debug options are handled later.
-#define DEBUGOPT(Name, Bits, Default)
-#define VALUE_DEBUGOPT(Name, Bits, Default)
-#define ENUM_DEBUGOPT(Name, Type, Bits, Default)
-#define CODEGENOPT(Name, Bits, Default) Name = Default;
-#define ENUM_CODEGENOPT(Name, Type, Bits, Default) set##Name(Default);
-#include "clang/Basic/CodeGenOptions.def"
-
-  // Next reset all debug options that can always be reset, because they never
-  // affect the PCM.
-#define DEBUGOPT(Name, Bits, Default)
-#define VALUE_DEBUGOPT(Name, Bits, Default)
-#define ENUM_DEBUGOPT(Name, Type, Bits, Default)
-#define BENIGN_DEBUGOPT(Name, Bits, Default) Name = Default;
-#define BENIGN_VALUE_DEBUGOPT(Name, Bits, Default) Name = Default;
-#define BENIGN_ENUM_DEBUGOPT(Name, Type, Bits, Default) set##Name(Default);
-#include "clang/Basic/DebugOptions.def"
-
-  // Conditionally reset debug options that only matter when the debug info is
-  // emitted into the PCM (-gmodules).
-  if (ModuleFormat == "raw") {
-#define DEBUGOPT(Name, Bits, Default) Name = Default;
-#define VALUE_DEBUGOPT(Name, Bits, Default) Name = Default;
-#define ENUM_DEBUGOPT(Name, Type, Bits, Default) set##Name(Default);
-#define BENIGN_DEBUGOPT(Name, Bits, Default)
-#define BENIGN_VALUE_DEBUGOPT(Name, Bits, Default)
-#define BENIGN_ENUM_DEBUGOPT(Name, Type, Bits, Default)
-#include "clang/Basic/DebugOptions.def"
-  }
-
-  RelocationModel = llvm::Reloc::PIC_;
-  memcpy(CoverageVersion, "408*", 4);
-}
-
 }  // end namespace clang

diff  --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 56de0f75928ca..be0d4963a2092 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -4787,18 +4787,6 @@ std::string CompilerInvocation::getModuleHash() const {
   if (getCodeGenOpts().DebugTypeExtRefs)
     HBuilder.addRange(getCodeGenOpts().DebugPrefixMap);
 
-  // Extend the signature with the affecting debug options.
-  if (getHeaderSearchOpts().ModuleFormat == "obj") {
-#define DEBUGOPT(Name, Bits, Default) HBuilder.add(CodeGenOpts->Name);
-#define VALUE_DEBUGOPT(Name, Bits, Default) HBuilder.add(CodeGenOpts->Name);
-#define ENUM_DEBUGOPT(Name, Type, Bits, Default)                               \
-  HBuilder.add(static_cast<unsigned>(CodeGenOpts->get##Name()));
-#define BENIGN_DEBUGOPT(Name, Bits, Default)
-#define BENIGN_VALUE_DEBUGOPT(Name, Bits, Default)
-#define BENIGN_ENUM_DEBUGOPT(Name, Type, Bits, Default)
-#include "clang/Basic/DebugOptions.def"
-  }
-
   // Extend the signature with the enabled sanitizers, if at least one is
   // enabled. Sanitizers which cannot affect AST generation aren't hashed.
   SanitizerSet SanHash = getLangOpts().Sanitize;
@@ -4845,7 +4833,6 @@ std::vector<std::string> CompilerInvocationBase::getCC1CommandLine() const {
 void CompilerInvocation::resetNonModularOptions() {
   getLangOpts().resetNonModularOptions();
   getPreprocessorOpts().resetNonModularOptions();
-  getCodeGenOpts().resetNonModularOptions(getHeaderSearchOpts().ModuleFormat);
 }
 
 void CompilerInvocation::clearImplicitModuleBuildOptions() {

diff  --git a/clang/test/ClangScanDeps/strip-codegen-args.m b/clang/test/ClangScanDeps/strip-codegen-args.m
deleted file mode 100644
index bb7e76e86aa2f..0000000000000
--- a/clang/test/ClangScanDeps/strip-codegen-args.m
+++ /dev/null
@@ -1,58 +0,0 @@
-// RUN: rm -rf %t
-// RUN: split-file %s %t
-// RUN: sed -e "s|DIR|%/t|g" %t/cdb1.json.template > %t/cdb1.json
-
-// RUN: clang-scan-deps -compilation-database %t/cdb1.json -format experimental-full > %t/result1.txt
-// RUN: FileCheck %s -input-file %t/result1.txt
-
-// This tests that codegen option that do not affect the AST or generation of a module are removed. 
-
-// CHECK:        "modules": [
-// CHECK-NEXT:     {
-// CHECK:            "command-line": [
-// CHECK-NOT:          "-flto"
-// CHECK-NOT:          "-fno-autolink"
-// CHECK-NOT:          "-mrelax-relocations=no"
-// CHECK:            ]
-// CHECK:            "name": "A"
-// CHECK:          }
-// CHECK-NOT:        "name": "A"
-// CHECK:        "translation-units"
-
-//--- cdb1.json.template
-[
-  {
-    "directory": "DIR",
-    "command": "clang -Imodules/A -fmodules -fmodules-cache-path=DIR/module-cache -fimplicit-modules -flto -fno-autolink -Xclang -mrelax-relocations=no -fsyntax-only DIR/t1.m",
-    "file": "DIR/t1.m"
-  },
-  {
-    "directory": "DIR",
-    "command": "clang -Imodules/A -fmodules -fmodules-cache-path=DIR/module-cache -fimplicit-modules -flto=thin -fautolink -fsyntax-only DIR/t2.m",
-    "file": "DIR/t2.m"
-  },
-  {
-    "directory": "DIR",
-    "command": "clang -Imodules/A -fmodules -fmodules-cache-path=DIR/module-cache -fimplicit-modules -flto=full -fsyntax-only DIR/t3.m",
-    "file": "DIR/t2.m"
-  }
-]
-
-//--- modules/A/module.modulemap
-
-module A {
-  umbrella header "A.h"
-}
-
-//--- modules/A/A.h
-
-typedef int A_t;
-
-//--- t1.m
- at import A;
-
-//--- t2.m
- at import A;
-
-//--- t3.m
- at import A;


        


More information about the cfe-commits mailing list