diff options
author | Vedant Kumar <vsk@apple.com> | 2019-07-11 19:28:07 +0000 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2019-07-11 19:28:07 +0000 |
commit | 8bd521472643f06c47377aa92c653ef4d79cb3fd (patch) | |
tree | 9442d50b60a46f214d99833354fc97d51565457e /clang/lib/CodeGen/CGDebugInfo.cpp | |
parent | 2bc8ab685289b7681e6ed0fa54f55bc505b47450 (diff) | |
download | bcm5719-llvm-8bd521472643f06c47377aa92c653ef4d79cb3fd.tar.gz bcm5719-llvm-8bd521472643f06c47377aa92c653ef4d79cb3fd.zip |
Revert "[CGDebugInfo] Simplify EmitFunctionDecl parameters, NFC"
This reverts commit 1af41074445229fea66b99710a850e5f42ecfa95.
llvm-svn: 365814
Diffstat (limited to 'clang/lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 50c344fd348..f6ee7ee26d4 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -3621,19 +3621,18 @@ void CGDebugInfo::EmitFunctionStart(GlobalDecl GD, SourceLocation Loc, RegionMap[D].reset(SP); } -llvm::DISubprogram *CGDebugInfo::EmitFunctionDecl(GlobalDecl GD, - SourceLocation Loc, - QualType FnType, - bool IsDeclForCallSite) { +void CGDebugInfo::EmitFunctionDecl(GlobalDecl GD, SourceLocation Loc, + QualType FnType, llvm::Function *Fn) { StringRef Name; StringRef LinkageName; const Decl *D = GD.getDecl(); if (!D) - return nullptr; + return; llvm::DINode::DIFlags Flags = llvm::DINode::FlagZero; llvm::DIFile *Unit = getOrCreateFile(Loc); + bool IsDeclForCallSite = Fn ? true : false; llvm::DIScope *FDContext = IsDeclForCallSite ? Unit : getDeclContextDescriptor(D); llvm::DINodeArray TParamsArray; @@ -3666,8 +3665,11 @@ llvm::DISubprogram *CGDebugInfo::EmitFunctionDecl(GlobalDecl GD, FDContext, Name, LinkageName, Unit, LineNo, getOrCreateFunctionType(D, FnType, Unit), ScopeLine, Flags, SPFlags, TParamsArray.get(), getFunctionDeclaration(D)); + + if (IsDeclForCallSite) + Fn->setSubprogram(SP); + DBuilder.retainType(SP); - return SP; } void CGDebugInfo::EmitFuncDeclForCallSite(llvm::CallBase *CallOrInvoke, @@ -3689,13 +3691,8 @@ void CGDebugInfo::EmitFuncDeclForCallSite(llvm::CallBase *CallOrInvoke, if (Func->getSubprogram()) return; - if (!CalleeDecl->isStatic() && !CalleeDecl->isInlined()) { - llvm::DISubprogram *SP = - EmitFunctionDecl(CalleeDecl, CalleeDecl->getLocation(), CalleeType, - /*IsDeclForCallSite=*/true); - assert(SP && "Could not find decl for callee?"); - Func->setSubprogram(SP); - } + if (!CalleeDecl->isStatic() && !CalleeDecl->isInlined()) + EmitFunctionDecl(CalleeDecl, CalleeDecl->getLocation(), CalleeType, Func); } void CGDebugInfo::EmitInlineFunctionStart(CGBuilderTy &Builder, GlobalDecl GD) { |