diff --git a/clang/include/clang/Basic/CodeGenOptions.h b/clang/include/clang/Basic/CodeGenOptions.h --- a/clang/include/clang/Basic/CodeGenOptions.h +++ b/clang/include/clang/Basic/CodeGenOptions.h @@ -13,10 +13,10 @@ #ifndef LLVM_CLANG_BASIC_CODEGENOPTIONS_H #define LLVM_CLANG_BASIC_CODEGENOPTIONS_H -#include "clang/Basic/DebugInfoOptions.h" #include "clang/Basic/Sanitizers.h" #include "clang/Basic/XRayInstr.h" #include "llvm/ADT/FloatingPointMode.h" +#include "llvm/Frontend/Debug/Options.h" #include "llvm/Support/CodeGen.h" #include "llvm/Support/Regex.h" #include "llvm/Target/TargetOptions.h" @@ -505,12 +505,12 @@ /// Check if type and variable info should be emitted. bool hasReducedDebugInfo() const { - return getDebugInfo() >= codegenoptions::DebugInfoConstructor; + return getDebugInfo() >= llvm::codegenoptions::DebugInfoConstructor; } /// Check if maybe unused type info should be emitted. bool hasMaybeUnusedDebugInfo() const { - return getDebugInfo() >= codegenoptions::UnusedTypeInfo; + return getDebugInfo() >= llvm::codegenoptions::UnusedTypeInfo; } // Check if any one of SanitizeCoverage* is enabled. diff --git a/clang/include/clang/Basic/CodeGenOptions.def b/clang/include/clang/Basic/CodeGenOptions.def --- a/clang/include/clang/Basic/CodeGenOptions.def +++ b/clang/include/clang/Basic/CodeGenOptions.def @@ -358,7 +358,7 @@ ///< template parameter descriptions in ///< forward declarations (versus just ///< including them in the name). -ENUM_CODEGENOPT(DebugSimpleTemplateNames, codegenoptions::DebugTemplateNamesKind, 2, codegenoptions::DebugTemplateNamesKind::Full) ///< Whether to emit template parameters +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 @@ -388,7 +388,7 @@ VALUE_CODEGENOPT(SSPBufferSize, 32, 0) /// The kind of generated debug info. -ENUM_CODEGENOPT(DebugInfo, codegenoptions::DebugInfoKind, 4, codegenoptions::NoDebugInfo) +ENUM_CODEGENOPT(DebugInfo, llvm::codegenoptions::DebugInfoKind, 4, llvm::codegenoptions::NoDebugInfo) /// Whether to generate macro debug info. CODEGENOPT(MacroDebugInfo, 1, 0) diff --git a/clang/include/clang/Driver/ToolChain.h b/clang/include/clang/Driver/ToolChain.h --- a/clang/include/clang/Driver/ToolChain.h +++ b/clang/include/clang/Driver/ToolChain.h @@ -9,7 +9,6 @@ #ifndef LLVM_CLANG_DRIVER_TOOLCHAIN_H #define LLVM_CLANG_DRIVER_TOOLCHAIN_H -#include "clang/Basic/DebugInfoOptions.h" #include "clang/Basic/LLVM.h" #include "clang/Basic/LangOptions.h" #include "clang/Basic/Sanitizers.h" @@ -21,6 +20,7 @@ #include "llvm/ADT/FloatingPointMode.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" +#include "llvm/Frontend/Debug/Options.h" #include "llvm/MC/MCTargetOptions.h" #include "llvm/Option/Option.h" #include "llvm/Support/VersionTuple.h" @@ -534,8 +534,8 @@ virtual void CheckObjCARC() const {} /// Get the default debug info format. Typically, this is DWARF. - virtual codegenoptions::DebugInfoFormat getDefaultDebugFormat() const { - return codegenoptions::DIF_DWARF; + virtual llvm::codegenoptions::DebugInfoFormat getDefaultDebugFormat() const { + return llvm::codegenoptions::DIF_DWARF; } /// UseDwarfDebugFlags - Embed the compile options to clang into the Dwarf @@ -571,8 +571,9 @@ } /// Adjust debug information kind considering all passed options. - virtual void adjustDebugInfoKind(codegenoptions::DebugInfoKind &DebugInfoKind, - const llvm::opt::ArgList &Args) const {} + virtual void + adjustDebugInfoKind(llvm::codegenoptions::DebugInfoKind &DebugInfoKind, + const llvm::opt::ArgList &Args) const {} /// GetExceptionModel - Return the tool chain exception model. virtual llvm::ExceptionHandling diff --git a/clang/lib/CodeGen/CGDebugInfo.h b/clang/lib/CodeGen/CGDebugInfo.h --- a/clang/lib/CodeGen/CGDebugInfo.h +++ b/clang/lib/CodeGen/CGDebugInfo.h @@ -56,7 +56,7 @@ friend class ApplyDebugLocation; friend class SaveAndRestoreLocation; CodeGenModule &CGM; - const codegenoptions::DebugInfoKind DebugKind; + const llvm::codegenoptions::DebugInfoKind DebugKind; bool DebugTypeExtRefs; llvm::DIBuilder DBuilder; llvm::DICompileUnit *TheCU = nullptr; diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -596,20 +596,20 @@ llvm::DICompileUnit::DebugEmissionKind EmissionKind; switch (DebugKind) { - case codegenoptions::NoDebugInfo: - case codegenoptions::LocTrackingOnly: + case llvm::codegenoptions::NoDebugInfo: + case llvm::codegenoptions::LocTrackingOnly: EmissionKind = llvm::DICompileUnit::NoDebug; break; - case codegenoptions::DebugLineTablesOnly: + case llvm::codegenoptions::DebugLineTablesOnly: EmissionKind = llvm::DICompileUnit::LineTablesOnly; break; - case codegenoptions::DebugDirectivesOnly: + case llvm::codegenoptions::DebugDirectivesOnly: EmissionKind = llvm::DICompileUnit::DebugDirectivesOnly; break; - case codegenoptions::DebugInfoConstructor: - case codegenoptions::LimitedDebugInfo: - case codegenoptions::FullDebugInfo: - case codegenoptions::UnusedTypeInfo: + case llvm::codegenoptions::DebugInfoConstructor: + case llvm::codegenoptions::LimitedDebugInfo: + case llvm::codegenoptions::FullDebugInfo: + case llvm::codegenoptions::UnusedTypeInfo: EmissionKind = llvm::DICompileUnit::FullDebug; break; } @@ -1990,7 +1990,7 @@ // In this debug mode, emit type info for a class when its constructor type // info is emitted. - if (DebugKind == codegenoptions::DebugInfoConstructor) + if (DebugKind == llvm::codegenoptions::DebugInfoConstructor) if (const CXXConstructorDecl *CD = dyn_cast(Method)) completeUnusedClass(*CD->getParent()); @@ -2462,7 +2462,7 @@ QualType AllocatedTy, SourceLocation Loc) { if (CGM.getCodeGenOpts().getDebugInfo() <= - codegenoptions::DebugLineTablesOnly) + llvm::codegenoptions::DebugLineTablesOnly) return; llvm::MDNode *node; if (AllocatedTy->isVoidType()) @@ -2474,7 +2474,7 @@ } void CGDebugInfo::completeType(const EnumDecl *ED) { - if (DebugKind <= codegenoptions::DebugLineTablesOnly) + if (DebugKind <= llvm::codegenoptions::DebugLineTablesOnly) return; QualType Ty = CGM.getContext().getEnumType(ED); void *TyPtr = Ty.getAsOpaquePtr(); @@ -2487,7 +2487,7 @@ } void CGDebugInfo::completeType(const RecordDecl *RD) { - if (DebugKind > codegenoptions::LimitedDebugInfo || + if (DebugKind > llvm::codegenoptions::LimitedDebugInfo || !CGM.getLangOpts().CPlusPlus) completeRequiredType(RD); } @@ -2549,7 +2549,7 @@ } void CGDebugInfo::completeClass(const RecordDecl *RD) { - if (DebugKind <= codegenoptions::DebugLineTablesOnly) + if (DebugKind <= llvm::codegenoptions::DebugLineTablesOnly) return; QualType Ty = CGM.getContext().getRecordType(RD); void *TyPtr = Ty.getAsOpaquePtr(); @@ -2597,7 +2597,7 @@ return false; } -static bool shouldOmitDefinition(codegenoptions::DebugInfoKind DebugKind, +static bool shouldOmitDefinition(llvm::codegenoptions::DebugInfoKind DebugKind, bool DebugTypeExtRefs, const RecordDecl *RD, const LangOptions &LangOpts) { if (DebugTypeExtRefs && isDefinedInClangModule(RD->getDefinition())) @@ -2610,10 +2610,10 @@ // Only emit forward declarations in line tables only to keep debug info size // small. This only applies to CodeView, since we don't emit types in DWARF // line tables only. - if (DebugKind == codegenoptions::DebugLineTablesOnly) + if (DebugKind == llvm::codegenoptions::DebugLineTablesOnly) return true; - if (DebugKind > codegenoptions::LimitedDebugInfo || + if (DebugKind > llvm::codegenoptions::LimitedDebugInfo || RD->hasAttr()) return false; @@ -2649,7 +2649,7 @@ // In constructor homing mode, only emit complete debug info for a class // when its constructor is emitted. - if ((DebugKind == codegenoptions::DebugInfoConstructor) && + if ((DebugKind == llvm::codegenoptions::DebugInfoConstructor) && canUseCtorHoming(CXXDecl)) return true; @@ -3477,7 +3477,8 @@ } void CGDebugInfo::completeUnusedClass(const CXXRecordDecl &D) { - if (DebugKind <= codegenoptions::DebugLineTablesOnly || D.isDynamicClass()) + if (DebugKind <= llvm::codegenoptions::DebugLineTablesOnly || + D.isDynamicClass()) return; completeClassData(&D); @@ -3811,17 +3812,18 @@ // No need to replicate the linkage name if it isn't different from the // subprogram name, no need to have it at all unless coverage is enabled or // debug is set to more than just line tables or extra debug info is needed. - if (LinkageName == Name || (!CGM.getCodeGenOpts().EmitGcovArcs && - !CGM.getCodeGenOpts().EmitGcovNotes && - !CGM.getCodeGenOpts().DebugInfoForProfiling && - !CGM.getCodeGenOpts().PseudoProbeForProfiling && - DebugKind <= codegenoptions::DebugLineTablesOnly)) + if (LinkageName == Name || + (!CGM.getCodeGenOpts().EmitGcovArcs && + !CGM.getCodeGenOpts().EmitGcovNotes && + !CGM.getCodeGenOpts().DebugInfoForProfiling && + !CGM.getCodeGenOpts().PseudoProbeForProfiling && + DebugKind <= llvm::codegenoptions::DebugLineTablesOnly)) LinkageName = StringRef(); // Emit the function scope in line tables only mode (if CodeView) to // differentiate between function names. if (CGM.getCodeGenOpts().hasReducedDebugInfo() || - (DebugKind == codegenoptions::DebugLineTablesOnly && + (DebugKind == llvm::codegenoptions::DebugLineTablesOnly && CGM.getCodeGenOpts().EmitCodeView)) { if (const NamespaceDecl *NSDecl = dyn_cast_or_null(FD->getDeclContext())) @@ -4013,7 +4015,7 @@ } llvm::DISubprogram *CGDebugInfo::getFunctionDeclaration(const Decl *D) { - if (!D || DebugKind <= codegenoptions::DebugLineTablesOnly) + if (!D || DebugKind <= llvm::codegenoptions::DebugLineTablesOnly) return nullptr; const auto *FD = dyn_cast(D); @@ -4050,7 +4052,7 @@ llvm::DISubprogram *CGDebugInfo::getObjCMethodDeclaration( const Decl *D, llvm::DISubroutineType *FnType, unsigned LineNo, llvm::DINode::DIFlags Flags, llvm::DISubprogram::DISPFlags SPFlags) { - if (!D || DebugKind <= codegenoptions::DebugLineTablesOnly) + if (!D || DebugKind <= llvm::codegenoptions::DebugLineTablesOnly) return nullptr; const auto *OMD = dyn_cast(D); @@ -4090,7 +4092,7 @@ llvm::DIFile *F) { // In CodeView, we emit the function types in line tables only because the // only way to distinguish between functions is by display name and type. - if (!D || (DebugKind <= codegenoptions::DebugLineTablesOnly && + if (!D || (DebugKind <= llvm::codegenoptions::DebugLineTablesOnly && !CGM.getCodeGenOpts().EmitCodeView)) // Create fake but valid subroutine type. Otherwise -verify would fail, and // subprogram DIE will miss DW_AT_decl_file and DW_AT_decl_line fields. @@ -4445,7 +4447,7 @@ CGM.getLLVMContext(), getLineNumber(Loc), getColumnNumber(Loc), LexicalBlockStack.back(), CurInlinedAt)); - if (DebugKind <= codegenoptions::DebugLineTablesOnly) + if (DebugKind <= llvm::codegenoptions::DebugLineTablesOnly) return; // Create a new lexical block and push it on the stack. @@ -4459,7 +4461,7 @@ // Provide an entry in the line table for the end of the block. EmitLocation(Builder, Loc); - if (DebugKind <= codegenoptions::DebugLineTablesOnly) + if (DebugKind <= llvm::codegenoptions::DebugLineTablesOnly) return; LexicalBlockStack.pop_back(); @@ -5276,11 +5278,11 @@ const NamedDecl *ND = dyn_cast(D); if (!ND) return Name; - codegenoptions::DebugTemplateNamesKind TemplateNamesKind = + llvm::codegenoptions::DebugTemplateNamesKind TemplateNamesKind = CGM.getCodeGenOpts().getDebugSimpleTemplateNames(); if (!CGM.getCodeGenOpts().hasReducedDebugInfo()) - TemplateNamesKind = codegenoptions::DebugTemplateNamesKind::Full; + TemplateNamesKind = llvm::codegenoptions::DebugTemplateNamesKind::Full; std::optional Args; @@ -5363,12 +5365,12 @@ PrintingPolicy PP = getPrintingPolicy(); - if (TemplateNamesKind == codegenoptions::DebugTemplateNamesKind::Full || + if (TemplateNamesKind == llvm::codegenoptions::DebugTemplateNamesKind::Full || !Reconstitutable) { ND->getNameForDiagnostic(OS, PP, Qualified); } else { - bool Mangled = - TemplateNamesKind == codegenoptions::DebugTemplateNamesKind::Mangled; + bool Mangled = TemplateNamesKind == + llvm::codegenoptions::DebugTemplateNamesKind::Mangled; // check if it's a template if (Mangled) OS << "_STN|"; @@ -5856,8 +5858,9 @@ llvm::DINode::DIFlags CGDebugInfo::getCallSiteRelatedAttrs() const { // Call site-related attributes are only useful in optimized programs, and // when there's a possibility of debugging backtraces. - if (!CGM.getLangOpts().Optimize || DebugKind == codegenoptions::NoDebugInfo || - DebugKind == codegenoptions::LocTrackingOnly) + if (!CGM.getLangOpts().Optimize || + DebugKind == llvm::codegenoptions::NoDebugInfo || + DebugKind == llvm::codegenoptions::LocTrackingOnly) return llvm::DINode::FlagZero; // Call site-related attributes are available in DWARF v5. Some debuggers, diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp --- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp @@ -1362,8 +1362,8 @@ unsigned Flags, bool EmitLoc) { uint32_t SrcLocStrSize; llvm::Constant *SrcLocStr; - if ((!EmitLoc && - CGM.getCodeGenOpts().getDebugInfo() == codegenoptions::NoDebugInfo) || + if ((!EmitLoc && CGM.getCodeGenOpts().getDebugInfo() == + llvm::codegenoptions::NoDebugInfo) || Loc.isInvalid()) { SrcLocStr = OMPBuilder.getOrCreateDefaultSrcLocStr(SrcLocStrSize); } else { @@ -9209,7 +9209,8 @@ // The information types are only built if there is debug information // requested. - if (CGM.getCodeGenOpts().getDebugInfo() == codegenoptions::NoDebugInfo) { + if (CGM.getCodeGenOpts().getDebugInfo() == + llvm::codegenoptions::NoDebugInfo) { Info.RTArgs.MapNamesArray = llvm::Constant::getNullValue( llvm::Type::getInt8Ty(CGF.Builder.getContext())->getPointerTo()); } else { @@ -9578,7 +9579,8 @@ Info.Pointers[I], CGM.getTypes().ConvertTypeForMem(C.VoidPtrTy)); llvm::Value *CurSizeArg = Info.Sizes[I]; llvm::Value *CurNameArg = - (CGM.getCodeGenOpts().getDebugInfo() == codegenoptions::NoDebugInfo) + (CGM.getCodeGenOpts().getDebugInfo() == + llvm::codegenoptions::NoDebugInfo) ? llvm::ConstantPointerNull::get(CGM.VoidPtrTy) : emitMappingInformation(MapperCGF, OMPBuilder, Info.Exprs[I]); @@ -10065,8 +10067,8 @@ CGOpenMPRuntime::TargetDataInfo Info; // Fill up the arrays and create the arguments. emitOffloadingArrays(CGF, CombinedInfo, Info, OMPBuilder); - bool EmitDebug = - CGF.CGM.getCodeGenOpts().getDebugInfo() != codegenoptions::NoDebugInfo; + bool EmitDebug = CGF.CGM.getCodeGenOpts().getDebugInfo() != + llvm::codegenoptions::NoDebugInfo; OMPBuilder.emitOffloadingArraysArgument(CGF.Builder, Info.RTArgs, Info, EmitDebug, /*ForEndCall=*/false); @@ -10676,8 +10678,8 @@ /*IsNonContiguous=*/true); llvm::OpenMPIRBuilder::TargetDataRTArgs RTArgs; - bool EmitDebug = - CGF.CGM.getCodeGenOpts().getDebugInfo() != codegenoptions::NoDebugInfo; + bool EmitDebug = CGF.CGM.getCodeGenOpts().getDebugInfo() != + llvm::codegenoptions::NoDebugInfo; OMPBuilder.emitOffloadingArraysArgument(CGF.Builder, RTArgs, Info, EmitDebug); @@ -10722,8 +10724,8 @@ assert(Info.isValid() && "Invalid data environment closing arguments."); llvm::OpenMPIRBuilder::TargetDataRTArgs RTArgs; - bool EmitDebug = - CGF.CGM.getCodeGenOpts().getDebugInfo() != codegenoptions::NoDebugInfo; + bool EmitDebug = CGF.CGM.getCodeGenOpts().getDebugInfo() != + llvm::codegenoptions::NoDebugInfo; OMPBuilder.emitOffloadingArraysArgument(CGF.Builder, RTArgs, Info, EmitDebug, /*ForEndCall=*/true); @@ -10946,8 +10948,8 @@ /*IsNonContiguous=*/true); bool RequiresOuterTask = D.hasClausesOfKind() || D.hasClausesOfKind(); - bool EmitDebug = - CGF.CGM.getCodeGenOpts().getDebugInfo() != codegenoptions::NoDebugInfo; + bool EmitDebug = CGF.CGM.getCodeGenOpts().getDebugInfo() != + llvm::codegenoptions::NoDebugInfo; OMPBuilder.emitOffloadingArraysArgument(CGF.Builder, Info.RTArgs, Info, EmitDebug, /*ForEndCall=*/false); diff --git a/clang/lib/CodeGen/CGVTables.cpp b/clang/lib/CodeGen/CGVTables.cpp --- a/clang/lib/CodeGen/CGVTables.cpp +++ b/clang/lib/CodeGen/CGVTables.cpp @@ -1045,19 +1045,20 @@ switch (keyFunction->getTemplateSpecializationKind()) { case TSK_Undeclared: case TSK_ExplicitSpecialization: - assert((def || CodeGenOpts.OptimizationLevel > 0 || - CodeGenOpts.getDebugInfo() != codegenoptions::NoDebugInfo) && - "Shouldn't query vtable linkage without key function, " - "optimizations, or debug info"); - if (!def && CodeGenOpts.OptimizationLevel > 0) - return llvm::GlobalVariable::AvailableExternallyLinkage; - - if (keyFunction->isInlined()) - return !Context.getLangOpts().AppleKext ? - llvm::GlobalVariable::LinkOnceODRLinkage : - llvm::Function::InternalLinkage; - - return llvm::GlobalVariable::ExternalLinkage; + assert( + (def || CodeGenOpts.OptimizationLevel > 0 || + CodeGenOpts.getDebugInfo() != llvm::codegenoptions::NoDebugInfo) && + "Shouldn't query vtable linkage without key function, " + "optimizations, or debug info"); + if (!def && CodeGenOpts.OptimizationLevel > 0) + return llvm::GlobalVariable::AvailableExternallyLinkage; + + if (keyFunction->isInlined()) + return !Context.getLangOpts().AppleKext + ? llvm::GlobalVariable::LinkOnceODRLinkage + : llvm::Function::InternalLinkage; + + return llvm::GlobalVariable::ExternalLinkage; case TSK_ImplicitInstantiation: return !Context.getLangOpts().AppleKext ? diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -174,7 +174,7 @@ // If debug info or coverage generation is enabled, create the CGDebugInfo // object. - if (CodeGenOpts.getDebugInfo() != codegenoptions::NoDebugInfo || + if (CodeGenOpts.getDebugInfo() != llvm::codegenoptions::NoDebugInfo || CodeGenOpts.EmitGcovArcs || CodeGenOpts.EmitGcovNotes) DebugInfo.reset(new CGDebugInfo(*this)); diff --git a/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp b/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp --- a/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp +++ b/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp @@ -158,7 +158,7 @@ // When building a module MainFileName is the name of the modulemap file. CodeGenOpts.MainFileName = LangOpts.CurrentModule.empty() ? MainFileName : LangOpts.CurrentModule; - CodeGenOpts.setDebugInfo(codegenoptions::FullDebugInfo); + CodeGenOpts.setDebugInfo(llvm::codegenoptions::FullDebugInfo); CodeGenOpts.setDebuggerTuning(CI.getCodeGenOpts().getDebuggerTuning()); CodeGenOpts.DebugPrefixMap = CI.getInvocation().getCodeGenOpts().DebugPrefixMap; diff --git a/clang/lib/Driver/ToolChains/Clang.h b/clang/lib/Driver/ToolChains/Clang.h --- a/clang/lib/Driver/ToolChains/Clang.h +++ b/clang/lib/Driver/ToolChains/Clang.h @@ -10,10 +10,10 @@ #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_CLANG_H #include "MSVC.h" -#include "clang/Basic/DebugInfoOptions.h" #include "clang/Driver/Driver.h" #include "clang/Driver/Tool.h" #include "clang/Driver/Types.h" +#include "llvm/Frontend/Debug/Options.h" #include "llvm/Option/Option.h" #include "llvm/Support/raw_ostream.h" #include "llvm/TargetParser/Triple.h" @@ -91,7 +91,7 @@ void AddClangCLArgs(const llvm::opt::ArgList &Args, types::ID InputType, llvm::opt::ArgStringList &CmdArgs, - codegenoptions::DebugInfoKind *DebugInfoKind, + llvm::codegenoptions::DebugInfoKind *DebugInfoKind, bool *EmitCodeView) const; mutable std::unique_ptr CompilationDatabase = nullptr; diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -405,18 +405,18 @@ // Convert an arg of the form "-gN" or "-ggdbN" or one of their aliases // to the corresponding DebugInfoKind. -static codegenoptions::DebugInfoKind DebugLevelToInfoKind(const Arg &A) { +static llvm::codegenoptions::DebugInfoKind DebugLevelToInfoKind(const Arg &A) { assert(A.getOption().matches(options::OPT_gN_Group) && "Not a -g option that specifies a debug-info level"); if (A.getOption().matches(options::OPT_g0) || A.getOption().matches(options::OPT_ggdb0)) - return codegenoptions::NoDebugInfo; + return llvm::codegenoptions::NoDebugInfo; if (A.getOption().matches(options::OPT_gline_tables_only) || A.getOption().matches(options::OPT_ggdb1)) - return codegenoptions::DebugLineTablesOnly; + return llvm::codegenoptions::DebugLineTablesOnly; if (A.getOption().matches(options::OPT_gline_directives_only)) - return codegenoptions::DebugDirectivesOnly; - return codegenoptions::DebugInfoConstructor; + return llvm::codegenoptions::DebugDirectivesOnly; + return llvm::codegenoptions::DebugInfoConstructor; } static bool mustUseNonLeafFramePointerForTarget(const llvm::Triple &Triple) { @@ -972,27 +972,28 @@ RelaxDefault); } -static void RenderDebugEnablingArgs(const ArgList &Args, ArgStringList &CmdArgs, - codegenoptions::DebugInfoKind DebugInfoKind, - unsigned DwarfVersion, - llvm::DebuggerKind DebuggerTuning) { +static void +RenderDebugEnablingArgs(const ArgList &Args, ArgStringList &CmdArgs, + llvm::codegenoptions::DebugInfoKind DebugInfoKind, + unsigned DwarfVersion, + llvm::DebuggerKind DebuggerTuning) { switch (DebugInfoKind) { - case codegenoptions::DebugDirectivesOnly: + case llvm::codegenoptions::DebugDirectivesOnly: CmdArgs.push_back("-debug-info-kind=line-directives-only"); break; - case codegenoptions::DebugLineTablesOnly: + case llvm::codegenoptions::DebugLineTablesOnly: CmdArgs.push_back("-debug-info-kind=line-tables-only"); break; - case codegenoptions::DebugInfoConstructor: + case llvm::codegenoptions::DebugInfoConstructor: CmdArgs.push_back("-debug-info-kind=constructor"); break; - case codegenoptions::LimitedDebugInfo: + case llvm::codegenoptions::LimitedDebugInfo: CmdArgs.push_back("-debug-info-kind=limited"); break; - case codegenoptions::FullDebugInfo: + case llvm::codegenoptions::FullDebugInfo: CmdArgs.push_back("-debug-info-kind=standalone"); break; - case codegenoptions::UnusedTypeInfo: + case llvm::codegenoptions::UnusedTypeInfo: CmdArgs.push_back("-debug-info-kind=unused-types"); break; default: @@ -2639,7 +2640,7 @@ CmdArgs.push_back(Value.data()); } else { RenderDebugEnablingArgs(Args, CmdArgs, - codegenoptions::DebugInfoConstructor, + llvm::codegenoptions::DebugInfoConstructor, DwarfVersion, llvm::DebuggerKind::Default); } } else if (Value.startswith("-mcpu") || Value.startswith("-mfpu") || @@ -4124,12 +4125,12 @@ DwarfFormatArg->render(Args, CmdArgs); } -static void renderDebugOptions(const ToolChain &TC, const Driver &D, - const llvm::Triple &T, const ArgList &Args, - bool EmitCodeView, bool IRInput, - ArgStringList &CmdArgs, - codegenoptions::DebugInfoKind &DebugInfoKind, - DwarfFissionKind &DwarfFission) { +static void +renderDebugOptions(const ToolChain &TC, const Driver &D, const llvm::Triple &T, + const ArgList &Args, bool EmitCodeView, bool IRInput, + ArgStringList &CmdArgs, + llvm::codegenoptions::DebugInfoKind &DebugInfoKind, + DwarfFissionKind &DwarfFission) { if (Args.hasFlag(options::OPT_fdebug_info_for_profiling, options::OPT_fno_debug_info_for_profiling, false) && checkDebugInfoOption( @@ -4164,7 +4165,7 @@ } } if (const Arg *A = Args.getLastArg(options::OPT_g_Group)) { - DebugInfoKind = codegenoptions::DebugInfoConstructor; + DebugInfoKind = llvm::codegenoptions::DebugInfoConstructor; // If the last option explicitly specified a debug-info level, use it. if (checkDebugInfoOption(A, Args, D, TC) && @@ -4174,9 +4175,9 @@ // complicated if you've disabled inline info in the skeleton CUs // (SplitDWARFInlining) - then there's value in composing split-dwarf and // line-tables-only, so let those compose naturally in that case. - if (DebugInfoKind == codegenoptions::NoDebugInfo || - DebugInfoKind == codegenoptions::DebugDirectivesOnly || - (DebugInfoKind == codegenoptions::DebugLineTablesOnly && + if (DebugInfoKind == llvm::codegenoptions::NoDebugInfo || + DebugInfoKind == llvm::codegenoptions::DebugDirectivesOnly || + (DebugInfoKind == llvm::codegenoptions::DebugLineTablesOnly && SplitDWARFInlining)) DwarfFission = DwarfFissionKind::None; } @@ -4210,12 +4211,12 @@ // If the user asked for debug info but did not explicitly specify -gcodeview // or -gdwarf, ask the toolchain for the default format. if (!EmitCodeView && !EmitDwarf && - DebugInfoKind != codegenoptions::NoDebugInfo) { + DebugInfoKind != llvm::codegenoptions::NoDebugInfo) { switch (TC.getDefaultDebugFormat()) { - case codegenoptions::DIF_CodeView: + case llvm::codegenoptions::DIF_CodeView: EmitCodeView = true; break; - case codegenoptions::DIF_DWARF: + case llvm::codegenoptions::DIF_DWARF: EmitDwarf = true; break; } @@ -4235,8 +4236,8 @@ // -gline-directives-only supported only for the DWARF debug info. if (RequestedDWARFVersion == 0 && - DebugInfoKind == codegenoptions::DebugDirectivesOnly) - DebugInfoKind = codegenoptions::NoDebugInfo; + DebugInfoKind == llvm::codegenoptions::DebugDirectivesOnly) + DebugInfoKind = llvm::codegenoptions::NoDebugInfo; // strict DWARF is set to false by default. But for DBX, we need it to be set // as true by default. @@ -4269,9 +4270,9 @@ // wins. if (checkDebugInfoOption(Args.getLastArg(options::OPT_gmodules), Args, D, TC)) { - if (DebugInfoKind != codegenoptions::DebugLineTablesOnly && - DebugInfoKind != codegenoptions::DebugDirectivesOnly) { - DebugInfoKind = codegenoptions::DebugInfoConstructor; + if (DebugInfoKind != llvm::codegenoptions::DebugLineTablesOnly && + DebugInfoKind != llvm::codegenoptions::DebugDirectivesOnly) { + DebugInfoKind = llvm::codegenoptions::DebugInfoConstructor; CmdArgs.push_back("-dwarf-ext-refs"); CmdArgs.push_back("-fmodule-format=obj"); } @@ -4293,13 +4294,13 @@ if (const Arg *A = Args.getLastArg(options::OPT_fstandalone_debug)) (void)checkDebugInfoOption(A, Args, D, TC); - if (DebugInfoKind == codegenoptions::LimitedDebugInfo || - DebugInfoKind == codegenoptions::DebugInfoConstructor) { + if (DebugInfoKind == llvm::codegenoptions::LimitedDebugInfo || + DebugInfoKind == llvm::codegenoptions::DebugInfoConstructor) { if (Args.hasFlag(options::OPT_fno_eliminate_unused_debug_types, options::OPT_feliminate_unused_debug_types, false)) - DebugInfoKind = codegenoptions::UnusedTypeInfo; + DebugInfoKind = llvm::codegenoptions::UnusedTypeInfo; else if (NeedFullDebug) - DebugInfoKind = codegenoptions::FullDebugInfo; + DebugInfoKind = llvm::codegenoptions::FullDebugInfo; } if (Args.hasFlag(options::OPT_gembed_source, options::OPT_gno_embed_source, @@ -4337,8 +4338,8 @@ // When emitting remarks, we need at least debug lines in the output. if (willEmitRemarks(Args) && - DebugInfoKind <= codegenoptions::DebugDirectivesOnly) - DebugInfoKind = codegenoptions::DebugLineTablesOnly; + DebugInfoKind <= llvm::codegenoptions::DebugDirectivesOnly) + DebugInfoKind = llvm::codegenoptions::DebugLineTablesOnly; // Adjust the debug info kind for the given toolchain. TC.adjustDebugInfoKind(DebugInfoKind, Args); @@ -5561,7 +5562,8 @@ RenderTargetOptions(Triple, Args, KernelOrKext, CmdArgs); // These two are potentially updated by AddClangCLArgs. - codegenoptions::DebugInfoKind DebugInfoKind = codegenoptions::NoDebugInfo; + llvm::codegenoptions::DebugInfoKind DebugInfoKind = + llvm::codegenoptions::NoDebugInfo; bool EmitCodeView = false; // Add clang-cl arguments. @@ -5577,7 +5579,7 @@ // This controls whether or not we perform JustMyCode instrumentation. if (Args.hasFlag(options::OPT_fjmc, options::OPT_fno_jmc, false)) { if (TC.getTriple().isOSBinFormatELF()) { - if (DebugInfoKind >= codegenoptions::DebugInfoConstructor) + if (DebugInfoKind >= llvm::codegenoptions::DebugInfoConstructor) CmdArgs.push_back("-fjmc"); else D.Diag(clang::diag::warn_drv_jmc_requires_debuginfo) << "-fjmc" @@ -7342,7 +7344,7 @@ if ((Triple.isOSBinFormatELF() || Triple.isOSBinFormatMachO()) && (EH || UnwindTables || AsyncUnwindTables || - DebugInfoKind != codegenoptions::NoDebugInfo)) + DebugInfoKind != llvm::codegenoptions::NoDebugInfo)) CmdArgs.push_back("-D__GCC_HAVE_DWARF2_CFI_ASM=1"); if (Arg *A = Args.getLastArg(options::OPT_fsymbol_partition_EQ)) { @@ -7644,7 +7646,7 @@ void Clang::AddClangCLArgs(const ArgList &Args, types::ID InputType, ArgStringList &CmdArgs, - codegenoptions::DebugInfoKind *DebugInfoKind, + llvm::codegenoptions::DebugInfoKind *DebugInfoKind, bool *EmitCodeView) const { bool isNVPTX = getToolChain().getTriple().isNVPTX(); @@ -7676,9 +7678,9 @@ options::OPT_gline_tables_only)) { *EmitCodeView = true; if (DebugInfoArg->getOption().matches(options::OPT__SLASH_Z7)) - *DebugInfoKind = codegenoptions::DebugInfoConstructor; + *DebugInfoKind = llvm::codegenoptions::DebugInfoConstructor; else - *DebugInfoKind = codegenoptions::DebugLineTablesOnly; + *DebugInfoKind = llvm::codegenoptions::DebugLineTablesOnly; } else { *EmitCodeView = false; } @@ -7688,7 +7690,8 @@ // This controls whether or not we perform JustMyCode instrumentation. if (Args.hasFlag(options::OPT__SLASH_JMC, options::OPT__SLASH_JMC_, /*Default=*/false)) { - if (*EmitCodeView && *DebugInfoKind >= codegenoptions::DebugInfoConstructor) + if (*EmitCodeView && + *DebugInfoKind >= llvm::codegenoptions::DebugInfoConstructor) CmdArgs.push_back("-fjmc"); else D.Diag(clang::diag::warn_drv_jmc_requires_debuginfo) << "/JMC" @@ -7990,7 +7993,8 @@ WantDebug = !A->getOption().matches(options::OPT_g0) && !A->getOption().matches(options::OPT_ggdb0); - codegenoptions::DebugInfoKind DebugInfoKind = codegenoptions::NoDebugInfo; + llvm::codegenoptions::DebugInfoKind DebugInfoKind = + llvm::codegenoptions::NoDebugInfo; // Add the -fdebug-compilation-dir flag if needed. const char *DebugCompilationDir = @@ -8002,8 +8006,8 @@ // the guard for source type, however there is a test which asserts // that some assembler invocation receives no -debug-info-kind, // and it's not clear whether that test is just overly restrictive. - DebugInfoKind = (WantDebug ? codegenoptions::DebugInfoConstructor - : codegenoptions::NoDebugInfo); + DebugInfoKind = (WantDebug ? llvm::codegenoptions::DebugInfoConstructor + : llvm::codegenoptions::NoDebugInfo); addDebugPrefixMapArg(getToolChain().getDriver(), getToolChain(), Args, CmdArgs); @@ -8115,7 +8119,7 @@ Args.AddAllArgs(CmdArgs, options::OPT_mllvm); - if (DebugInfoKind > codegenoptions::NoDebugInfo && Output.isFilename()) + if (DebugInfoKind > llvm::codegenoptions::NoDebugInfo && Output.isFilename()) addDebugObjectName(Args, CmdArgs, DebugCompilationDir, Output.getFilename()); diff --git a/clang/lib/Driver/ToolChains/Cuda.h b/clang/lib/Driver/ToolChains/Cuda.h --- a/clang/lib/Driver/ToolChains/Cuda.h +++ b/clang/lib/Driver/ToolChains/Cuda.h @@ -156,7 +156,7 @@ bool IsMathErrnoDefault() const override { return false; } bool supportsDebugInfoOption(const llvm::opt::Arg *A) const override; - void adjustDebugInfoKind(codegenoptions::DebugInfoKind &DebugInfoKind, + void adjustDebugInfoKind(llvm::codegenoptions::DebugInfoKind &DebugInfoKind, const llvm::opt::ArgList &Args) const override; // NVPTX supports only DWARF2. diff --git a/clang/lib/Driver/ToolChains/Cuda.cpp b/clang/lib/Driver/ToolChains/Cuda.cpp --- a/clang/lib/Driver/ToolChains/Cuda.cpp +++ b/clang/lib/Driver/ToolChains/Cuda.cpp @@ -748,13 +748,14 @@ } void NVPTXToolChain::adjustDebugInfoKind( - codegenoptions::DebugInfoKind &DebugInfoKind, const ArgList &Args) const { + llvm::codegenoptions::DebugInfoKind &DebugInfoKind, + const ArgList &Args) const { switch (mustEmitDebugInfo(Args)) { case DisableDebugInfo: - DebugInfoKind = codegenoptions::NoDebugInfo; + DebugInfoKind = llvm::codegenoptions::NoDebugInfo; break; case DebugDirectivesOnly: - DebugInfoKind = codegenoptions::DebugDirectivesOnly; + DebugInfoKind = llvm::codegenoptions::DebugDirectivesOnly; break; case EmitSameDebugInfoAsHost: // Use same debug info level as the host. diff --git a/clang/lib/Driver/ToolChains/HIPSPV.h b/clang/lib/Driver/ToolChains/HIPSPV.h --- a/clang/lib/Driver/ToolChains/HIPSPV.h +++ b/clang/lib/Driver/ToolChains/HIPSPV.h @@ -77,7 +77,7 @@ computeMSVCVersion(const Driver *D, const llvm::opt::ArgList &Args) const override; - void adjustDebugInfoKind(codegenoptions::DebugInfoKind &DebugInfoKind, + void adjustDebugInfoKind(llvm::codegenoptions::DebugInfoKind &DebugInfoKind, const llvm::opt::ArgList &Args) const override; bool IsIntegratedAssemblerDefault() const override { return true; } bool IsMathErrnoDefault() const override { return false; } diff --git a/clang/lib/Driver/ToolChains/HIPSPV.cpp b/clang/lib/Driver/ToolChains/HIPSPV.cpp --- a/clang/lib/Driver/ToolChains/HIPSPV.cpp +++ b/clang/lib/Driver/ToolChains/HIPSPV.cpp @@ -283,10 +283,10 @@ } void HIPSPVToolChain::adjustDebugInfoKind( - codegenoptions::DebugInfoKind &DebugInfoKind, + llvm::codegenoptions::DebugInfoKind &DebugInfoKind, const llvm::opt::ArgList &Args) const { // Debug info generation is disabled for SPIRV-LLVM-Translator // which currently aborts on the presence of DW_OP_LLVM_convert. // TODO: Enable debug info when the SPIR-V backend arrives. - DebugInfoKind = codegenoptions::NoDebugInfo; + DebugInfoKind = llvm::codegenoptions::NoDebugInfo; } diff --git a/clang/lib/Driver/ToolChains/MSVC.h b/clang/lib/Driver/ToolChains/MSVC.h --- a/clang/lib/Driver/ToolChains/MSVC.h +++ b/clang/lib/Driver/ToolChains/MSVC.h @@ -11,10 +11,10 @@ #include "AMDGPU.h" #include "Cuda.h" -#include "clang/Basic/DebugInfoOptions.h" #include "clang/Driver/Compilation.h" #include "clang/Driver/Tool.h" #include "clang/Driver/ToolChain.h" +#include "llvm/Frontend/Debug/Options.h" #include "llvm/WindowsDriver/MSVCPaths.h" namespace clang { @@ -60,9 +60,10 @@ /// Set CodeView as the default debug info format for non-MachO binary /// formats, and to DWARF otherwise. Users can use -gcodeview and -gdwarf to /// override the default. - codegenoptions::DebugInfoFormat getDefaultDebugFormat() const override { - return getTriple().isOSBinFormatMachO() ? codegenoptions::DIF_DWARF - : codegenoptions::DIF_CodeView; + llvm::codegenoptions::DebugInfoFormat getDefaultDebugFormat() const override { + return getTriple().isOSBinFormatMachO() + ? llvm::codegenoptions::DIF_DWARF + : llvm::codegenoptions::DIF_CodeView; } /// Set the debugger tuning to "default", since we're definitely not tuning diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -12,7 +12,6 @@ #include "clang/Basic/CharInfo.h" #include "clang/Basic/CodeGenOptions.h" #include "clang/Basic/CommentOptions.h" -#include "clang/Basic/DebugInfoOptions.h" #include "clang/Basic/Diagnostic.h" #include "clang/Basic/DiagnosticDriver.h" #include "clang/Basic/DiagnosticOptions.h" @@ -59,6 +58,7 @@ #include "llvm/ADT/StringSwitch.h" #include "llvm/ADT/Twine.h" #include "llvm/Config/llvm-config.h" +#include "llvm/Frontend/Debug/Options.h" #include "llvm/IR/DebugInfoMetadata.h" #include "llvm/Linker/Linker.h" #include "llvm/MC/MCTargetOptions.h" @@ -1397,28 +1397,28 @@ std::optional DebugInfoVal; switch (Opts.DebugInfo) { - case codegenoptions::DebugLineTablesOnly: + case llvm::codegenoptions::DebugLineTablesOnly: DebugInfoVal = "line-tables-only"; break; - case codegenoptions::DebugDirectivesOnly: + case llvm::codegenoptions::DebugDirectivesOnly: DebugInfoVal = "line-directives-only"; break; - case codegenoptions::DebugInfoConstructor: + case llvm::codegenoptions::DebugInfoConstructor: DebugInfoVal = "constructor"; break; - case codegenoptions::LimitedDebugInfo: + case llvm::codegenoptions::LimitedDebugInfo: DebugInfoVal = "limited"; break; - case codegenoptions::FullDebugInfo: + case llvm::codegenoptions::FullDebugInfo: DebugInfoVal = "standalone"; break; - case codegenoptions::UnusedTypeInfo: + case llvm::codegenoptions::UnusedTypeInfo: DebugInfoVal = "unused-types"; break; - case codegenoptions::NoDebugInfo: // default value + case llvm::codegenoptions::NoDebugInfo: // default value DebugInfoVal = std::nullopt; break; - case codegenoptions::LocTrackingOnly: // implied value + case llvm::codegenoptions::LocTrackingOnly: // implied value DebugInfoVal = std::nullopt; break; } @@ -1463,10 +1463,10 @@ GenerateArg(Args, OPT_gpubnames, SA); auto TNK = Opts.getDebugSimpleTemplateNames(); - if (TNK != codegenoptions::DebugTemplateNamesKind::Full) { - if (TNK == codegenoptions::DebugTemplateNamesKind::Simple) + if (TNK != llvm::codegenoptions::DebugTemplateNamesKind::Full) { + if (TNK == llvm::codegenoptions::DebugTemplateNamesKind::Simple) GenerateArg(Args, OPT_gsimple_template_names_EQ, "simple", SA); - else if (TNK == codegenoptions::DebugTemplateNamesKind::Mangled) + else if (TNK == llvm::codegenoptions::DebugTemplateNamesKind::Mangled) GenerateArg(Args, OPT_gsimple_template_names_EQ, "mangled", SA); } // ProfileInstrumentUsePath is marshalled automatically, no need to generate @@ -1667,18 +1667,19 @@ if (Arg *A = Args.getLastArg(OPT_debug_info_kind_EQ)) { unsigned Val = llvm::StringSwitch(A->getValue()) - .Case("line-tables-only", codegenoptions::DebugLineTablesOnly) - .Case("line-directives-only", codegenoptions::DebugDirectivesOnly) - .Case("constructor", codegenoptions::DebugInfoConstructor) - .Case("limited", codegenoptions::LimitedDebugInfo) - .Case("standalone", codegenoptions::FullDebugInfo) - .Case("unused-types", codegenoptions::UnusedTypeInfo) + .Case("line-tables-only", llvm::codegenoptions::DebugLineTablesOnly) + .Case("line-directives-only", + llvm::codegenoptions::DebugDirectivesOnly) + .Case("constructor", llvm::codegenoptions::DebugInfoConstructor) + .Case("limited", llvm::codegenoptions::LimitedDebugInfo) + .Case("standalone", llvm::codegenoptions::FullDebugInfo) + .Case("unused-types", llvm::codegenoptions::UnusedTypeInfo) .Default(~0U); if (Val == ~0U) Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << A->getValue(); else - Opts.setDebugInfo(static_cast(Val)); + Opts.setDebugInfo(static_cast(Val)); } // If -fuse-ctor-homing is set and limited debug info is already on, then use @@ -1686,11 +1687,11 @@ if (const Arg *A = Args.getLastArg(OPT_fuse_ctor_homing, OPT_fno_use_ctor_homing)) { if (A->getOption().matches(OPT_fuse_ctor_homing) && - Opts.getDebugInfo() == codegenoptions::LimitedDebugInfo) - Opts.setDebugInfo(codegenoptions::DebugInfoConstructor); + Opts.getDebugInfo() == llvm::codegenoptions::LimitedDebugInfo) + Opts.setDebugInfo(llvm::codegenoptions::DebugInfoConstructor); if (A->getOption().matches(OPT_fno_use_ctor_homing) && - Opts.getDebugInfo() == codegenoptions::DebugInfoConstructor) - Opts.setDebugInfo(codegenoptions::LimitedDebugInfo); + Opts.getDebugInfo() == llvm::codegenoptions::DebugInfoConstructor) + Opts.setDebugInfo(llvm::codegenoptions::LimitedDebugInfo); } for (const auto &Arg : Args.getAllArgValues(OPT_fdebug_prefix_map_EQ)) { @@ -1745,8 +1746,8 @@ << A->getSpelling() << A->getValue(); Opts.setDebugSimpleTemplateNames( StringRef(A->getValue()) == "simple" - ? codegenoptions::DebugTemplateNamesKind::Simple - : codegenoptions::DebugTemplateNamesKind::Mangled); + ? llvm::codegenoptions::DebugTemplateNamesKind::Simple + : llvm::codegenoptions::DebugTemplateNamesKind::Mangled); } if (const Arg *A = Args.getLastArg(OPT_ftime_report, OPT_ftime_report_EQ)) { @@ -2040,8 +2041,9 @@ // If the user requested a flag that requires source locations available in // the backend, make sure that the backend tracks source location information. - if (NeedLocTracking && Opts.getDebugInfo() == codegenoptions::NoDebugInfo) - Opts.setDebugInfo(codegenoptions::LocTrackingOnly); + if (NeedLocTracking && + Opts.getDebugInfo() == llvm::codegenoptions::NoDebugInfo) + Opts.setDebugInfo(llvm::codegenoptions::LocTrackingOnly); // Parse -fsanitize-recover= arguments. // FIXME: Report unrecoverable sanitizers incorrectly specified here. diff --git a/clang/lib/Frontend/Rewrite/FrontendActions.cpp b/clang/lib/Frontend/Rewrite/FrontendActions.cpp --- a/clang/lib/Frontend/Rewrite/FrontendActions.cpp +++ b/clang/lib/Frontend/Rewrite/FrontendActions.cpp @@ -165,10 +165,11 @@ if (std::unique_ptr OS = CI.createDefaultOutputFile(false, InFile, "cpp")) { if (CI.getLangOpts().ObjCRuntime.isNonFragile()) - return CreateModernObjCRewriter( - std::string(InFile), std::move(OS), CI.getDiagnostics(), - CI.getLangOpts(), CI.getDiagnosticOpts().NoRewriteMacros, - (CI.getCodeGenOpts().getDebugInfo() != codegenoptions::NoDebugInfo)); + return CreateModernObjCRewriter(std::string(InFile), std::move(OS), + CI.getDiagnostics(), CI.getLangOpts(), + CI.getDiagnosticOpts().NoRewriteMacros, + (CI.getCodeGenOpts().getDebugInfo() != + llvm::codegenoptions::NoDebugInfo)); return CreateObjCRewriter(std::string(InFile), std::move(OS), CI.getDiagnostics(), CI.getLangOpts(), CI.getDiagnosticOpts().NoRewriteMacros); diff --git a/clang/tools/clang-import-test/clang-import-test.cpp b/clang/tools/clang-import-test/clang-import-test.cpp --- a/clang/tools/clang-import-test/clang-import-test.cpp +++ b/clang/tools/clang-import-test/clang-import-test.cpp @@ -200,7 +200,7 @@ Inv->getLangOpts()->CXXExceptions = true; // Needed for testing dynamic_cast. Inv->getLangOpts()->RTTI = true; - Inv->getCodeGenOpts().setDebugInfo(codegenoptions::FullDebugInfo); + Inv->getCodeGenOpts().setDebugInfo(llvm::codegenoptions::FullDebugInfo); Inv->getTargetOpts().Triple = llvm::sys::getDefaultTargetTriple(); Ins->setInvocation(std::move(Inv)); diff --git a/clang/include/clang/Basic/DebugInfoOptions.h b/llvm/include/llvm/Frontend/Debug/Options.h rename from clang/include/clang/Basic/DebugInfoOptions.h rename to llvm/include/llvm/Frontend/Debug/Options.h --- a/clang/include/clang/Basic/DebugInfoOptions.h +++ b/llvm/include/llvm/Frontend/Debug/Options.h @@ -6,10 +6,10 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_CLANG_BASIC_DEBUGINFOOPTIONS_H -#define LLVM_CLANG_BASIC_DEBUGINFOOPTIONS_H +#ifndef LLVM_FRONTEND_DEBUG_OPTIONS_H +#define LLVM_FRONTEND_DEBUG_OPTIONS_H -namespace clang { +namespace llvm { namespace codegenoptions { enum DebugInfoFormat { @@ -54,13 +54,9 @@ UnusedTypeInfo, }; -enum class DebugTemplateNamesKind { - Full, - Simple, - Mangled -}; +enum class DebugTemplateNamesKind { Full, Simple, Mangled }; } // end namespace codegenoptions -} // end namespace clang +} // end namespace llvm #endif