diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-03-31 02:06:28 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-03-31 02:06:28 +0000 |
commit | dd77af870f12d722652da0ed28a7c3dbd3da348e (patch) | |
tree | fefa1378eb6bfccaa800d5c94fc4bcc67400e8ac /llvm/lib/IR/DebugInfo.cpp | |
parent | 3b960c9da0fc42f88d3192508ecfc126529f1a6d (diff) | |
download | bcm5719-llvm-dd77af870f12d722652da0ed28a7c3dbd3da348e.tar.gz bcm5719-llvm-dd77af870f12d722652da0ed28a7c3dbd3da348e.zip |
DebugInfo: Rewrite llvm::getDISubprogram(), NFC
Simplify implementation of `llvm::getDISubprogram()`. I might go
through and see how difficult it is to update the users, since this
function doesn't really seem necessary anymore.
llvm-svn: 233662
Diffstat (limited to 'llvm/lib/IR/DebugInfo.cpp')
-rw-r--r-- | llvm/lib/IR/DebugInfo.cpp | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp index aa61283918f..d841e3ca9c6 100644 --- a/llvm/lib/IR/DebugInfo.cpp +++ b/llvm/lib/IR/DebugInfo.cpp @@ -461,17 +461,9 @@ DIVariable llvm::cleanseInlinedVariable(MDNode *DV, LLVMContext &VMContext) { } DISubprogram llvm::getDISubprogram(const MDNode *Scope) { - DIDescriptor D(Scope); - if (D.isSubprogram()) - return DISubprogram(Scope); - - if (D.isLexicalBlockFile()) - return getDISubprogram(DILexicalBlockFile(Scope).getContext()); - - if (D.isLexicalBlock()) - return getDISubprogram(DILexicalBlock(Scope).getContext()); - - return DISubprogram(); + if (auto *LocalScope = dyn_cast_or_null<MDLocalScope>(Scope)) + return LocalScope->getSubprogram(); + return nullptr; } DISubprogram llvm::getDISubprogram(const Function *F) { |