From 81a8d62b948d81b623fa32348e90e2f16229ac59 Mon Sep 17 00:00:00 2001 From: "Duncan P. N. Exon Smith" Date: Tue, 31 Mar 2015 02:06:28 +0000 Subject: [PATCH] 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233662 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/IR/DebugInfo.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/lib/IR/DebugInfo.cpp b/lib/IR/DebugInfo.cpp index aa61283918f..d841e3ca9c6 100644 --- a/lib/IR/DebugInfo.cpp +++ b/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(Scope)) + return LocalScope->getSubprogram(); + return nullptr; } DISubprogram llvm::getDISubprogram(const Function *F) { -- 2.34.1