From fd07a2af23c6999c854d351bf865ce6407cee629 Mon Sep 17 00:00:00 2001 From: "Duncan P. N. Exon Smith" Date: Mon, 30 Mar 2015 21:32:28 +0000 Subject: DwarfDebug: Avoid creating new DebugLocs in the backend Don't use `DebugLoc::getFnDebugLoc()`, which creates new `MDLocation`s, in the backend. We just want to grab the subprogram here anyway. llvm-svn: 233601 --- llvm/lib/IR/DebugInfoMetadata.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'llvm/lib/IR/DebugInfoMetadata.cpp') diff --git a/llvm/lib/IR/DebugInfoMetadata.cpp b/llvm/lib/IR/DebugInfoMetadata.cpp index 754740a34ee..8dd4c2f5f03 100644 --- a/llvm/lib/IR/DebugInfoMetadata.cpp +++ b/llvm/lib/IR/DebugInfoMetadata.cpp @@ -238,6 +238,12 @@ MDCompileUnit *MDCompileUnit::getImpl( (SourceLanguage, IsOptimized, RuntimeVersion, EmissionKind), Ops); } +MDSubprogram *MDLocalScope::getSubprogram() const { + if (auto *Block = dyn_cast(this)) + return Block->getScope()->getSubprogram(); + return const_cast(cast(this)); +} + MDSubprogram *MDSubprogram::getImpl( LLVMContext &Context, Metadata *Scope, MDString *Name, MDString *LinkageName, Metadata *File, unsigned Line, Metadata *Type, -- cgit v1.2.3