Debug Info: improve the Finder.
Improve the Finder to handle context of a DIVariable.
If Scope is a DICompileUnit, add it to the list of CUs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187003 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/IR/DebugInfo.cpp b/lib/IR/DebugInfo.cpp
index 0fbfd2d..b611f45 100644
--- a/lib/IR/DebugInfo.cpp
+++ b/lib/IR/DebugInfo.cpp
@@ -908,6 +908,14 @@
processType(Ty);
return;
}
+ if (Scope.isCompileUnit()) {
+ addCompileUnit(DICompileUnit(Scope));
+ return;
+ }
+ if (Scope.isSubprogram()) {
+ processSubprogram(DISubprogram(Scope));
+ return;
+ }
if (!addScope(Scope))
return;
if (Scope.isLexicalBlock()) {
@@ -954,6 +962,7 @@
if (!NodesSeen.insert(DV))
return;
+ processScope(DIVariable(N).getContext());
processType(DIVariable(N).getType());
}