diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 2a11eebf1b682..bac113289f507 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -4611,7 +4611,7 @@ void CGDebugInfo::EmitFunctionDecl(GlobalDecl GD, SourceLocation Loc, // Preserve btf_decl_tag attributes for parameters of extern functions // for BPF target. The parameters created in this loop are attached as - // DISubprogram's retainedNodes in the subsequent finalizeSubprogram call. + // DISubprogram's retainedNodes in the DIBuilder::finalize() call. if (IsDeclForCallSite && CGM.getTarget().getTriple().isBPF()) { if (auto *FD = dyn_cast(D)) { llvm::DITypeRefArray ParamTypes = STy->getTypeArray(); @@ -4628,8 +4628,6 @@ void CGDebugInfo::EmitFunctionDecl(GlobalDecl GD, SourceLocation Loc, if (IsDeclForCallSite) Fn->setSubprogram(SP); - - DBuilder.finalizeSubprogram(SP); } void CGDebugInfo::EmitFuncDeclForCallSite(llvm::CallBase *CallOrInvoke, diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp index 90da9f3acfe57..35e61caf9a241 100644 --- a/llvm/lib/IR/DIBuilder.cpp +++ b/llvm/lib/IR/DIBuilder.cpp @@ -940,8 +940,7 @@ DISubprogram *DIBuilder::createFunction( SPFlags, IsDefinition ? CUNode : nullptr, TParams, Decl, nullptr, ThrownTypes, Annotations, TargetFuncName); - if (IsDefinition) - AllSubprograms.push_back(Node); + AllSubprograms.push_back(Node); trackIfUnresolved(Node); return Node; } @@ -978,8 +977,7 @@ DISubprogram *DIBuilder::createMethod( Flags, SPFlags, IsDefinition ? CUNode : nullptr, TParams, nullptr, nullptr, ThrownTypes); - if (IsDefinition) - AllSubprograms.push_back(SP); + AllSubprograms.push_back(SP); trackIfUnresolved(SP); return SP; }