[llvm] r186867 - Debug Info Finder: add processScope to actually handle the Scope.

Manman Ren manman.ren at gmail.com
Mon Jul 22 13:28:54 PDT 2013


Author: mren
Date: Mon Jul 22 15:28:53 2013
New Revision: 186867

URL: http://llvm.org/viewvc/llvm-project?rev=186867&view=rev
Log:
Debug Info Finder: add processScope to actually handle the Scope.

Instead of just adding the scope to the list, we actually handle the scope.

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

Modified: llvm/trunk/include/llvm/DebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo.h?rev=186867&r1=186866&r2=186867&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo.h (original)
+++ llvm/trunk/include/llvm/DebugInfo.h Mon Jul 22 15:28:53 2013
@@ -756,6 +756,8 @@ namespace llvm {
     /// processLocation - Process DILocation.
     void processLocation(DILocation Loc);
 
+    void processScope(DIScope Scope);
+
     /// addCompileUnit - Add compile unit into CUs.
     bool addCompileUnit(DICompileUnit CU);
 

Modified: llvm/trunk/lib/IR/DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfo.cpp?rev=186867&r1=186866&r2=186867&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DebugInfo.cpp (original)
+++ llvm/trunk/lib/IR/DebugInfo.cpp Mon Jul 22 15:28:53 2013
@@ -857,7 +857,7 @@ void DebugInfoFinder::processModule(cons
       for (unsigned i = 0, e = GVs.getNumElements(); i != e; ++i) {
         DIGlobalVariable DIG(GVs.getElement(i));
         if (addGlobalVariable(DIG)) {
-          addScope(DIG.getContext());
+          processScope(DIG.getContext());
           processType(DIG.getType());
         }
       }
@@ -897,7 +897,7 @@ void DebugInfoFinder::processLocation(DI
 void DebugInfoFinder::processType(DIType DT) {
   if (!addType(DT))
     return;
-  addScope(DT.getContext());
+  processScope(DT.getContext());
   if (DT.isCompositeType()) {
     DICompositeType DCT(DT);
     processType(DCT.getTypeDerivedFrom());
@@ -915,6 +915,26 @@ void DebugInfoFinder::processType(DIType
   }
 }
 
+void DebugInfoFinder::processScope(DIScope Scope) {
+  if (Scope.isType()) {
+    DIType Ty(Scope);
+    processType(Ty);
+    return;
+  }
+  if (!addScope(Scope))
+    return;
+  if (Scope.isLexicalBlock()) {
+    DILexicalBlock LB(Scope);
+    processScope(LB.getContext());
+  } else if (Scope.isLexicalBlockFile()) {
+    DILexicalBlockFile LBF = DILexicalBlockFile(Scope);
+    processScope(LBF.getScope());
+  } else if (Scope.isNameSpace()) {
+    DINameSpace NS(Scope);
+    processScope(NS.getContext());
+  }
+}
+
 /// processLexicalBlock
 void DebugInfoFinder::processLexicalBlock(DILexicalBlock LB) {
   DIScope Context = LB.getContext();
@@ -932,7 +952,7 @@ void DebugInfoFinder::processLexicalBloc
 void DebugInfoFinder::processSubprogram(DISubprogram SP) {
   if (!addSubprogram(SP))
     return;
-  addScope(SP.getContext());
+  processScope(SP.getContext());
   processType(SP.getType());
 }
 





More information about the llvm-commits mailing list