]> granicus.if.org Git - clang/commitdiff
Debug Info: Simplify the code changed in r182403 to reduce indent & avoid a duplicate...
authorDavid Blaikie <dblaikie@gmail.com>
Tue, 21 May 2013 18:29:40 +0000 (18:29 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Tue, 21 May 2013 18:29:40 +0000 (18:29 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182404 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGDebugInfo.cpp

index 726f7361fc5f259cd4458a87a8d6328e3153734e..d1da81d2599af72db833d83a8ecef7960e7959bc 100644 (file)
@@ -1932,21 +1932,20 @@ llvm::DIType CGDebugInfo::getOrCreateType(QualType Ty, llvm::DIFile Unit) {
     // the ObjCInterfaceCache together with a checksum. Instead of
     // the (possibly) incomplete interface type, we return a forward
     // declaration that gets RAUW'd in CGDebugInfo::finalize().
-    llvm::DenseMap<void *, std::pair<llvm::WeakVH, unsigned > >
-      ::iterator it = ObjCInterfaceCache.find(TyPtr);
-    if (it != ObjCInterfaceCache.end())
-      TC = llvm::DIType(cast<llvm::MDNode>(it->second.first));
-    else {
-      TC = DBuilder.createForwardDecl(llvm::dwarf::DW_TAG_structure_type,
-                                      Decl->getName(), TheCU, Unit,
-                                      getLineNumber(Decl->getLocation()),
-                                      TheCU.getLanguage());
-      // Store the forward declaration in the cache.
-      ObjCInterfaceCache[TyPtr] = std::make_pair(TC, Checksum(Decl));
-
-      // Register the type for replacement in finalize().
-      ReplaceMap.push_back(std::make_pair(TyPtr, static_cast<llvm::Value*>(TC)));
-    }
+    std::pair<llvm::WeakVH, unsigned> &V = ObjCInterfaceCache[TyPtr];
+    if (V.first)
+      return llvm::DIType(cast<llvm::MDNode>(V.first));
+    TC = DBuilder.createForwardDecl(llvm::dwarf::DW_TAG_structure_type,
+                                    Decl->getName(), TheCU, Unit,
+                                    getLineNumber(Decl->getLocation()),
+                                    TheCU.getLanguage());
+    // Store the forward declaration in the cache.
+    V.first = TC;
+    V.second = Checksum(Decl);
+
+    // Register the type for replacement in finalize().
+    ReplaceMap.push_back(std::make_pair(TyPtr, static_cast<llvm::Value*>(TC)));
+
     return TC;
   }