[llvm] r216840 - Delay adding imported entity DIEs to the lexical scope, streamlining the check for "this scope has nothing in it"

David Blaikie dblaikie at gmail.com
Sat Aug 30 22:46:17 PDT 2014


Author: dblaikie
Date: Sun Aug 31 00:46:17 2014
New Revision: 216840

URL: http://llvm.org/viewvc/llvm-project?rev=216840&view=rev
Log:
Delay adding imported entity DIEs to the lexical scope, streamlining the check for "this scope has nothing in it"

This makes the emptiness of the scope with regards to variables and
nested scopes is the same as with regards to imported entities. Just
check if we had nothing at all before we build the node.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=216840&r1=216839&r2=216840&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Sun Aug 31 00:46:17 2014
@@ -597,14 +597,14 @@ std::unique_ptr<DIE> DwarfDebug::constru
                          ScopesWithImportedEntities.end(),
                          std::pair<const MDNode *, const MDNode *>(DS, nullptr),
                          less_first());
-    if (Children.empty() && Range.first == Range.second)
-      return nullptr;
-    ScopeDIE = constructLexicalScopeDIE(TheCU, Scope);
-    assert(ScopeDIE && "Scope DIE should not be null.");
     for (ImportedEntityMap::const_iterator i = Range.first; i != Range.second;
          ++i)
-      ScopeDIE->addChild(
+      Children.push_back(
           constructImportedEntityDIE(TheCU, DIImportedEntity(i->second)));
+    if (Children.empty())
+      return nullptr;
+    ScopeDIE = constructLexicalScopeDIE(TheCU, Scope);
+    assert(ScopeDIE && "Scope DIE should not be null.");
   }
 
   // Add children





More information about the llvm-commits mailing list