[llvm-commits] [llvm] r78602 - in /llvm/trunk: include/llvm/Analysis/DebugInfo.h lib/Analysis/DebugInfo.cpp

Devang Patel dpatel at apple.com
Mon Aug 10 15:09:58 PDT 2009


Author: dpatel
Date: Mon Aug 10 17:09:58 2009
New Revision: 78602

URL: http://llvm.org/viewvc/llvm-project?rev=78602&view=rev
Log:
Keep track of DIType.

Modified:
    llvm/trunk/include/llvm/Analysis/DebugInfo.h
    llvm/trunk/lib/Analysis/DebugInfo.cpp

Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DebugInfo.h?rev=78602&r1=78601&r2=78602&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Analysis/DebugInfo.h (original)
+++ llvm/trunk/include/llvm/Analysis/DebugInfo.h Mon Aug 10 17:09:58 2009
@@ -643,6 +643,9 @@
     // addSubprogram - Add subprgoram into SPs.
     bool addSubprogram(DISubprogram SP);
 
+    /// addType - Add type into Tys.
+    bool addType(DIType DT);
+
   public:
     typedef SmallVector<GlobalVariable *, 8>::iterator iterator;
     iterator compile_unit_begin()    { return CUs.begin(); }
@@ -651,15 +654,19 @@
     iterator subprogram_end()        { return SPs.end(); }
     iterator global_variable_begin() { return GVs.begin(); }
     iterator global_variable_end()   { return GVs.end(); }
+    iterator type_begin()            { return TYs.begin(); }
+    iterator type_end()              { return TYs.end(); }
 
     unsigned compile_unit_count()    { return CUs.size(); }
     unsigned global_variable_count() { return GVs.size(); }
     unsigned subprogram_count()      { return SPs.size(); }
+    unsigned type_count()            { return TYs.size(); }
 
   private:
     SmallVector<GlobalVariable *, 8> CUs;  // Compile Units
     SmallVector<GlobalVariable *, 8> SPs;  // Subprograms
-    SmallVector<GlobalVariable *, 8> GVs;  // Global Variables;
+    SmallVector<GlobalVariable *, 8> GVs;  // Global Variables
+    SmallVector<GlobalVariable *, 8> TYs;  // Types
     SmallPtrSet<GlobalVariable *, 64> NodesSeen;
     
   };

Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DebugInfo.cpp?rev=78602&r1=78601&r2=78602&view=diff

==============================================================================
--- llvm/trunk/lib/Analysis/DebugInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/DebugInfo.cpp Mon Aug 10 17:09:58 2009
@@ -955,9 +955,7 @@
     
 /// processType - Process DIType.
 void DebugInfoFinder::processType(DIType DT) {
-  if (DT.isNull())
-    return;
-  if (!NodesSeen.insert(DT.getGV()))
+  if (!addType(DT))
     return;
 
   addCompileUnit(DT.getCompileUnit());
@@ -1028,6 +1026,18 @@
   processType(DV.getType());
 }
 
+/// addType - Add type into Tys.
+bool DebugInfoFinder::addType(DIType DT) {
+  if (DT.isNull())
+    return false;
+
+  if (!NodesSeen.insert(DT.getGV()))
+    return false;
+
+  TYs.push_back(DT.getGV());
+  return true;
+}
+
 /// addCompileUnit - Add compile unit into CUs.
 bool DebugInfoFinder::addCompileUnit(DICompileUnit CU) {
   if (CU.isNull())





More information about the llvm-commits mailing list