-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[clang][modules] Reset codegen options. (#74006)
CodeGen options do not affect the AST, so they usually can be ignored. The only exception to the rule is when a PCM is created with `-gmodules`. In that case the Clang module format is switched to object file container and contains also serialized debug information that can be affected by debug options. There the following approach was choosen: 1.) Split out all the debug options into a separate `DebugOptions.def` file. The file is included by `CodeGenOptions.def`, so the change is transparent to all existing users of `CodeGenOptions.def`. 2.) Reset all CodeGen options, but excluding affecting debug options. 3.) Conditionally reset debug options that can affect the PCM. This fixes rdar://113135909.
- Loading branch information
Showing
7 changed files
with
260 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
//===--- 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.