aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManman Ren <manman.ren@gmail.com>2013-07-22 20:28:53 +0000
committerManman Ren <manman.ren@gmail.com>2013-07-22 20:28:53 +0000
commitfdd16bb91842b9cd8525d0a9202eb001233afcb5 (patch)
tree01f7cae1c133ac6ed40e2538a9074f262f5d1a6f
parent0dcba2fadb990ba2298ba43d76372c754b240cee (diff)
downloadexternal_llvm-fdd16bb91842b9cd8525d0a9202eb001233afcb5.zip
external_llvm-fdd16bb91842b9cd8525d0a9202eb001233afcb5.tar.gz
external_llvm-fdd16bb91842b9cd8525d0a9202eb001233afcb5.tar.bz2
Debug Info Finder: add processScope to actually handle the Scope.
Instead of just adding the scope to the list, we actually handle the scope. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186867 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/DebugInfo.h2
-rw-r--r--lib/IR/DebugInfo.cpp26
2 files changed, 25 insertions, 3 deletions
diff --git a/include/llvm/DebugInfo.h b/include/llvm/DebugInfo.h
index 5c74b17..d05b328 100644
--- a/include/llvm/DebugInfo.h
+++ b/include/llvm/DebugInfo.h
@@ -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);
diff --git a/lib/IR/DebugInfo.cpp b/lib/IR/DebugInfo.cpp
index f6ffc03..f63fa1a 100644
--- a/lib/IR/DebugInfo.cpp
+++ b/lib/IR/DebugInfo.cpp
@@ -857,7 +857,7 @@ void DebugInfoFinder::processModule(const Module &M) {
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(DILocation Loc) {
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 DT) {
}
}
+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::processLexicalBlock(DILexicalBlock LB) {
void DebugInfoFinder::processSubprogram(DISubprogram SP) {
if (!addSubprogram(SP))
return;
- addScope(SP.getContext());
+ processScope(SP.getContext());
processType(SP.getType());
}