[llvm] r216839 - Modify DwarfDebug::constructImportedEntityDIE to return rather than insert into the scope

David Blaikie dblaikie at gmail.com
Sat Aug 30 22:41:16 PDT 2014


Author: dblaikie
Date: Sun Aug 31 00:41:15 2014
New Revision: 216839

URL: http://llvm.org/viewvc/llvm-project?rev=216839&view=rev
Log:
Modify DwarfDebug::constructImportedEntityDIE to return rather than insert into the scope

Another step towards improving lexical_scope handling

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

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=216839&r1=216838&r2=216839&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Sun Aug 31 00:41:15 2014
@@ -603,7 +603,8 @@ std::unique_ptr<DIE> DwarfDebug::constru
     assert(ScopeDIE && "Scope DIE should not be null.");
     for (ImportedEntityMap::const_iterator i = Range.first; i != Range.second;
          ++i)
-      constructImportedEntityDIE(TheCU, i->second, *ScopeDIE);
+      ScopeDIE->addChild(
+          constructImportedEntityDIE(TheCU, DIImportedEntity(i->second)));
   }
 
   // Add children
@@ -683,21 +684,14 @@ DwarfCompileUnit &DwarfDebug::constructD
   return NewCU;
 }
 
-void DwarfDebug::constructImportedEntityDIE(DwarfCompileUnit &TheCU,
-                                            const MDNode *N) {
+void DwarfDebug::constructAndAddImportedEntityDIE(DwarfCompileUnit &TheCU,
+                                                  const MDNode *N) {
   DIImportedEntity Module(N);
   assert(Module.Verify());
   if (DIE *D = TheCU.getOrCreateContextDIE(Module.getContext()))
     D->addChild(constructImportedEntityDIE(TheCU, Module));
 }
 
-void DwarfDebug::constructImportedEntityDIE(DwarfCompileUnit &TheCU,
-                                            const MDNode *N, DIE &Context) {
-  DIImportedEntity Module(N);
-  assert(Module.Verify());
-  Context.addChild(constructImportedEntityDIE(TheCU, Module));
-}
-
 std::unique_ptr<DIE>
 DwarfDebug::constructImportedEntityDIE(DwarfCompileUnit &TheCU,
                                        const DIImportedEntity &Module) {
@@ -785,7 +779,7 @@ void DwarfDebug::beginModule() {
     // Emit imported_modules last so that the relevant context is already
     // available.
     for (unsigned i = 0, e = ImportedEntities.getNumElements(); i != e; ++i)
-      constructImportedEntityDIE(CU, ImportedEntities.getElement(i));
+      constructAndAddImportedEntityDIE(CU, ImportedEntities.getElement(i));
   }
 
   // Tell MMI that we have debug info.

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=216839&r1=216838&r2=216839&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Sun Aug 31 00:41:15 2014
@@ -508,11 +508,8 @@ class DwarfDebug : public AsmPrinterHand
   DwarfCompileUnit &constructDwarfCompileUnit(DICompileUnit DIUnit);
 
   /// \brief Construct imported_module or imported_declaration DIE.
-  void constructImportedEntityDIE(DwarfCompileUnit &TheCU, const MDNode *N);
-
-  /// \brief Construct import_module DIE.
-  void constructImportedEntityDIE(DwarfCompileUnit &TheCU, const MDNode *N,
-                                  DIE &Context);
+  void constructAndAddImportedEntityDIE(DwarfCompileUnit &TheCU,
+                                        const MDNode *N);
 
   /// \brief Construct import_module DIE.
   std::unique_ptr<DIE>





More information about the llvm-commits mailing list