aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorManman Ren <manman.ren@gmail.com>2013-09-09 22:35:23 +0000
committerManman Ren <manman.ren@gmail.com>2013-09-09 22:35:23 +0000
commite72aba9c0ff5b19128f54b09a36d2f4c2a53b40b (patch)
treece4a3987eb6b832a55395bf05be09aac775f2c54 /lib
parentee50a46026a8e131bd1b82df729d1c45f856d0ec (diff)
downloadexternal_llvm-e72aba9c0ff5b19128f54b09a36d2f4c2a53b40b.zip
external_llvm-e72aba9c0ff5b19128f54b09a36d2f4c2a53b40b.tar.gz
external_llvm-e72aba9c0ff5b19128f54b09a36d2f4c2a53b40b.tar.bz2
Debug Info: move DIScope::getContext back from DwarfDebug.
This partially reverts r190330. DIScope::getContext now returns DIScopeRef instead of DIScope. We construct a DIScopeRef from DIScope when we are dealing with subprogram, lexical block or name space. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190362 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp2
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfDebug.cpp23
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfDebug.h3
-rw-r--r--lib/IR/DebugInfo.cpp23
4 files changed, 24 insertions, 27 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
index 1a527f2..4893c25 100644
--- a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
@@ -919,7 +919,7 @@ static bool isTypeUnitScoped(DIType Ty, const DwarfDebug *DD) {
// Don't generate a hash for anything scoped inside a function.
if (Parent.isSubprogram())
return false;
- Parent = DD->getScopeContext(Parent);
+ Parent = DD->resolve(Parent.getContext());
}
return true;
}
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 79bb884..7db6df0 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -2649,26 +2649,3 @@ void DwarfDebug::emitDebugStrDWO() {
DIScope DwarfDebug::resolve(DIScopeRef SRef) const {
return SRef.resolve(TypeIdentifierMap);
}
-
-// If the current node has a parent scope then return that,
-// else return an empty scope.
-DIScope DwarfDebug::getScopeContext(DIScope S) const {
-
- if (S.isType())
- return resolve(DIType(S).getContext());
-
- if (S.isSubprogram())
- return DISubprogram(S).getContext();
-
- if (S.isLexicalBlock())
- return DILexicalBlock(S).getContext();
-
- if (S.isLexicalBlockFile())
- return DILexicalBlockFile(S).getContext();
-
- if (S.isNameSpace())
- return DINameSpace(S).getContext();
-
- assert((S.isFile() || S.isCompileUnit()) && "Unhandled type of scope.");
- return DIScope();
-}
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.h b/lib/CodeGen/AsmPrinter/DwarfDebug.h
index c18fe37..e026c66 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.h
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.h
@@ -690,9 +690,6 @@ public:
/// or another context nested inside a subprogram.
bool isSubprogramContext(const MDNode *Context);
- /// Gets the parent scope for this scope node or returns a
- /// default constructed scope.
- DIScope getScopeContext(DIScope S) const;
};
} // End of namespace llvm
diff --git a/lib/IR/DebugInfo.cpp b/lib/IR/DebugInfo.cpp
index e0b5964..51c9e58 100644
--- a/lib/IR/DebugInfo.cpp
+++ b/lib/IR/DebugInfo.cpp
@@ -785,6 +785,29 @@ Value *DITemplateValueParameter::getValue() const {
return getField(DbgNode, 4);
}
+// If the current node has a parent scope then return that,
+// else return an empty scope.
+DIScopeRef DIScope::getContext() const {
+
+ if (isType())
+ return DIType(DbgNode).getContext();
+
+ if (isSubprogram())
+ return DIScopeRef(DISubprogram(DbgNode).getContext());
+
+ if (isLexicalBlock())
+ return DIScopeRef(DILexicalBlock(DbgNode).getContext());
+
+ if (isLexicalBlockFile())
+ return DIScopeRef(DILexicalBlockFile(DbgNode).getContext());
+
+ if (isNameSpace())
+ return DIScopeRef(DINameSpace(DbgNode).getContext());
+
+ assert((isFile() || isCompileUnit()) && "Unhandled type of scope.");
+ return DIScopeRef(NULL);
+}
+
StringRef DIScope::getFilename() const {
if (!DbgNode)
return StringRef();