diff options
Diffstat (limited to 'clang/lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 75 |
1 files changed, 39 insertions, 36 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index a5d2cf9..4a85ff0 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -596,20 +596,20 @@ void CGDebugInfo::CreateCompileUnit() { 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 @@ llvm::DISubprogram *CGDebugInfo::CreateCXXMemberFunction( // 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<CXXConstructorDecl>(Method)) completeUnusedClass(*CD->getParent()); @@ -2462,7 +2462,7 @@ void CGDebugInfo::addHeapAllocSiteMetadata(llvm::CallBase *CI, 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::addHeapAllocSiteMetadata(llvm::CallBase *CI, } 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 EnumDecl *ED) { } 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::completeClassData(const RecordDecl *RD) { } 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 @@ static bool canUseCtorHoming(const CXXRecordDecl *RD) { 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 @@ static bool shouldOmitDefinition(codegenoptions::DebugInfoKind DebugKind, // 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<StandaloneDebugAttr>()) return false; @@ -2649,7 +2649,7 @@ static bool shouldOmitDefinition(codegenoptions::DebugInfoKind DebugKind, // 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::completeTemplateDefinition( } 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 @@ void CGDebugInfo::collectFunctionDeclProps(GlobalDecl GD, llvm::DIFile *Unit, // 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<NamespaceDecl>(FD->getDeclContext())) @@ -4013,7 +4015,7 @@ llvm::DINode *CGDebugInfo::getDeclarationOrDefinition(const Decl *D) { } 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<FunctionDecl>(D); @@ -4050,7 +4052,7 @@ llvm::DISubprogram *CGDebugInfo::getFunctionDeclaration(const Decl *D) { 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<ObjCMethodDecl>(D); @@ -4090,7 +4092,7 @@ llvm::DISubroutineType *CGDebugInfo::getOrCreateFunctionType(const Decl *D, 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 @@ void CGDebugInfo::EmitLexicalBlockStart(CGBuilderTy &Builder, 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 @@ void CGDebugInfo::EmitLexicalBlockEnd(CGBuilderTy &Builder, // 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 @@ std::string CGDebugInfo::GetName(const Decl *D, bool Qualified) const { const NamedDecl *ND = dyn_cast<NamedDecl>(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<TemplateArgs> Args; @@ -5363,12 +5365,12 @@ std::string CGDebugInfo::GetName(const Decl *D, bool Qualified) const { 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::DebugLoc CGDebugInfo::SourceLocToDebugLoc(SourceLocation Loc) { 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, |