From 7f288cef47abe4b5fce83cb6c625603920effedb Mon Sep 17 00:00:00 2001 From: "Duncan P. N. Exon Smith" Date: Tue, 14 Apr 2015 03:24:14 +0000 Subject: [PATCH] DebugInfo: Prepare for DISubprogram/DILexicalBlock* to be gutted An upcoming LLVM commit will remove this API, so stop using it. Just access the raw pointers using `operator->()`. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234848 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGDebugInfo.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index e2bbb6d427..992d61eaea 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -126,10 +126,9 @@ void CGDebugInfo::setLocation(SourceLocation Loc) { if (PCLoc.isInvalid() || Scope.getFilename() == PCLoc.getFilename()) return; - if (llvm::DILexicalBlockFile LBF = - dyn_cast(Scope)) { + if (auto *LBF = dyn_cast(Scope)) { llvm::DIDescriptor D = DBuilder.createLexicalBlockFile( - LBF.getContext(), getOrCreateFile(CurLoc)); + LBF->getScope(), getOrCreateFile(CurLoc)); llvm::MDNode *N = D; LexicalBlockStack.pop_back(); LexicalBlockStack.emplace_back(N); @@ -2500,16 +2499,16 @@ llvm::DISubprogram CGDebugInfo::getFunctionDeclaration(const Decl *D) { } } if (MI != SPCache.end()) { - llvm::DISubprogram SP = dyn_cast_or_null(MI->second); - if (SP && !SP.isDefinition()) + auto *SP = dyn_cast_or_null(MI->second); + if (SP && !SP->isDefinition()) return SP; } for (auto NextFD : FD->redecls()) { auto MI = SPCache.find(NextFD->getCanonicalDecl()); if (MI != SPCache.end()) { - llvm::DISubprogram SP = dyn_cast_or_null(MI->second); - if (SP && !SP.isDefinition()) + auto *SP = dyn_cast_or_null(MI->second); + if (SP && !SP->isDefinition()) return SP; } } @@ -2603,8 +2602,8 @@ void CGDebugInfo::EmitFunctionStart(GlobalDecl GD, SourceLocation Loc, // If there is a DISubprogram for this function available then use it. auto FI = SPCache.find(FD->getCanonicalDecl()); if (FI != SPCache.end()) { - llvm::DISubprogram SP = dyn_cast_or_null(FI->second); - if (SP && SP.isDefinition()) { + auto *SP = dyn_cast_or_null(FI->second); + if (SP && SP->isDefinition()) { llvm::MDNode *SPN = SP; LexicalBlockStack.emplace_back(SPN); RegionMap[D].reset(SP); -- 2.40.0