r234848 - DebugInfo: Prepare for DISubprogram/DILexicalBlock* to be gutted

Duncan P. N. Exon Smith dexonsmith at apple.com
Mon Apr 13 20:24:14 PDT 2015


Author: dexonsmith
Date: Mon Apr 13 22:24:14 2015
New Revision: 234848

URL: http://llvm.org/viewvc/llvm-project?rev=234848&view=rev
Log:
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->()`.

Modified:
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=234848&r1=234847&r2=234848&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon Apr 13 22:24:14 2015
@@ -126,10 +126,9 @@ void CGDebugInfo::setLocation(SourceLoca
   if (PCLoc.isInvalid() || Scope.getFilename() == PCLoc.getFilename())
     return;
 
-  if (llvm::DILexicalBlockFile LBF =
-          dyn_cast<llvm::MDLexicalBlockFile>(Scope)) {
+  if (auto *LBF = dyn_cast<llvm::MDLexicalBlockFile>(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::getFunct
     }
   }
   if (MI != SPCache.end()) {
-    llvm::DISubprogram SP = dyn_cast_or_null<llvm::MDSubprogram>(MI->second);
-    if (SP && !SP.isDefinition())
+    auto *SP = dyn_cast_or_null<llvm::MDSubprogram>(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<llvm::MDSubprogram>(MI->second);
-      if (SP && !SP.isDefinition())
+      auto *SP = dyn_cast_or_null<llvm::MDSubprogram>(MI->second);
+      if (SP && !SP->isDefinition())
         return SP;
     }
   }
@@ -2603,8 +2602,8 @@ void CGDebugInfo::EmitFunctionStart(Glob
     // 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<llvm::MDSubprogram>(FI->second);
-      if (SP && SP.isDefinition()) {
+      auto *SP = dyn_cast_or_null<llvm::MDSubprogram>(FI->second);
+      if (SP && SP->isDefinition()) {
         llvm::MDNode *SPN = SP;
         LexicalBlockStack.emplace_back(SPN);
         RegionMap[D].reset(SP);





More information about the cfe-commits mailing list