//===--- 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).
//
//===----------------------------------------------------------------------===//
#ifndef DEBUGOPT
#define DEBUGOPT(Name, Bits, Default, Compatibility) \
CODEGENOPT(Name, Bits, Default, Compatibility)
#endif

#ifndef VALUE_DEBUGOPT
#  define VALUE_DEBUGOPT(Name, Bits, Default, Compatibility) \
VALUE_CODEGENOPT(Name, Bits, Default, Compatibility)
#endif

#ifndef ENUM_DEBUGOPT
#  define ENUM_DEBUGOPT(Name, Type, Bits, Default, Compatibility) \
ENUM_CODEGENOPT(Name, Type, Bits, Default, Compatibility)
#endif

ENUM_DEBUGOPT(CompressDebugSections, DebugCompressionType, 2,
                     DebugCompressionType::None, Benign)
DEBUGOPT(Dwarf64, 1, 0, Compatible) ///< -gdwarf64.
DEBUGOPT(EnableDIPreservationVerify, 1, 0, Benign) ///< Enable di preservation
                                                   ///< verify each (it means
                                                   ///< check the original debug
                                                   ///< info metadata
                                                   ///< preservation).
DEBUGOPT(ForceDwarfFrameSection , 1, 0, Benign) ///< Set when -fforce-dwarf-frame
                                                ///< is enabled.

///< Set when -femit-dwarf-unwind is passed.
ENUM_DEBUGOPT(EmitDwarfUnwind, EmitDwarfUnwindType, 2,
              EmitDwarfUnwindType::Default, Benign)

DEBUGOPT(NoDwarfDirectoryAsm , 1, 0, Benign) ///< Set when -fno-dwarf-directory-asm
                                             ///< is enabled.

DEBUGOPT(Dwarf2CFIAsm, 1, 0, NotCompatible) ///< Set when -fdwarf2-cfi-asm is enabled.

DEBUGOPT(NoInlineLineTables, 1, 0, Benign) ///< Whether debug info should contain
                                           ///< inline line tables.

DEBUGOPT(DebugStrictDwarf, 1, 1, Compatible) ///< Whether or not to use strict DWARF info.
DEBUGOPT(DebugOmitUnreferencedMethods, 1, 0, Compatible) ///< Omit unreferenced member
                                                        ///< functions in type debug info.

/// Control the Assignment Tracking debug info feature.
ENUM_DEBUGOPT(AssignmentTrackingMode, AssignmentTrackingOpts, 2,
              AssignmentTrackingOpts::Disabled, Benign)

/// Whether or not to use Key Instructions to determine breakpoint locations.
DEBUGOPT(DebugKeyInstructions, 1, 0, Benign)

DEBUGOPT(DebugColumnInfo, 1, 0, Compatible) ///< Whether or not to use column information
                                           ///< in debug info.

/// Whether or not to include call site information in debug info.
DEBUGOPT(DebugCallSiteInfo, 1, 1, Benign)

DEBUGOPT(DebugTypeExtRefs, 1, 0, Compatible) ///< Whether or not debug info should contain
                                            ///< external references to a PCH or module.

DEBUGOPT(DebugExplicitImport, 1, 0, Compatible)  ///< 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, Compatible)

DEBUGOPT(SplitDwarfInlining, 1, 1, Compatible) ///< Whether to include inlining info in the
                                              ///< skeleton CU to allow for symbolication
                                              ///< of inline stack frames without .dwo files.
DEBUGOPT(DebugFwdTemplateParams, 1, 0, Compatible) ///< Whether to emit complete
                                                  ///< template parameter descriptions in
                                                  ///< forward declarations (versus just
                                                  ///< including them in the name).
ENUM_DEBUGOPT(DebugSimpleTemplateNames,
              DebugTemplateNamesKind, 2,
              DebugTemplateNamesKind::Full, Compatible)
              ///< 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, DebugInfoKind, 4,
              DebugInfoKind::NoDebugInfo, Compatible)

/// Whether to generate macro debug info.
DEBUGOPT(MacroDebugInfo, 1, 0, Compatible)

/// Whether to use expansion location for debug info.
/// TODO: #175249: Remove once testing is complete for sample pgo users.
DEBUGOPT(DebugInfoMacroExpansionLoc, 1, 0, Compatible)

/// Tune the debug info for this debugger.
ENUM_DEBUGOPT(DebuggerTuning, DebuggerKind, 3,
              DebuggerKind::Default, Compatible)

/// Dwarf version. Version zero indicates to LLVM that no DWARF should be
/// emitted.
VALUE_DEBUGOPT(DwarfVersion, 3, 0, Compatible)

/// Whether we should emit CodeView debug information. It's possible to emit
/// CodeView and DWARF into the same object.
DEBUGOPT(EmitCodeView, 1, 0, Compatible)

/// Whether to emit the .debug$H section containing hashes of CodeView types.
DEBUGOPT(CodeViewGHash, 1, 0, Compatible)

/// Whether to emit the compiler path and command line into the CodeView debug information.
DEBUGOPT(CodeViewCommandLine, 1, 0, Compatible)

/// Whether emit extra debug info for sample pgo profile collection.
DEBUGOPT(DebugInfoForProfiling, 1, 0, Compatible)

/// Whether to emit DW_TAG_template_alias for template aliases.
DEBUGOPT(DebugTemplateAlias, 1, 0, Compatible)

/// Whether to emit .debug_gnu_pubnames section instead of .debug_pubnames.
DEBUGOPT(DebugNameTable, 2, 0, Compatible)

/// Whether to use DWARF base address specifiers in .debug_ranges.
DEBUGOPT(DebugRangesBaseAddress, 1, 0, Compatible)

/// Whether to add linkage names to constructor/destructor declarations.
/// This is an escape hatch for cases where attaching the additional linkage
/// names would increase debug-info size (particularly the .debug_str section)
/// too much.
DEBUGOPT(DebugStructorDeclLinkageNames, 1, 0, Benign)

/// Whether to embed source in DWARF debug line section.
DEBUGOPT(EmbedSource, 1, 0, Compatible)

#undef DEBUGOPT
#undef ENUM_DEBUGOPT
#undef VALUE_DEBUGOPT
