summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2010-03-08 22:02:50 +0000
committerDevang Patel <dpatel@apple.com>2010-03-08 22:02:50 +0000
commit8119fe87d8a04810c848a94cdc8b9523d17538fd (patch)
treea3bc2177710dceed7098520afbec60253f60a0fa /llvm/lib/Analysis
parent4bd5f8ceca41c935de7bc531745cb9d448844ddc (diff)
downloadbcm5719-llvm-8119fe87d8a04810c848a94cdc8b9523d17538fd.tar.gz
bcm5719-llvm-8119fe87d8a04810c848a94cdc8b9523d17538fd.zip
Derive DIType from DIScope. This simplifies getContext() where for members the context is a type. This also eliminates need of CompileUnitMaps maintained by dwarf writer.
llvm-svn: 97990
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/DebugInfo.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/DebugInfo.cpp b/llvm/lib/Analysis/DebugInfo.cpp
index 5e931c69f7c..4ea1ce94b16 100644
--- a/llvm/lib/Analysis/DebugInfo.cpp
+++ b/llvm/lib/Analysis/DebugInfo.cpp
@@ -243,7 +243,7 @@ bool DIDescriptor::isEnumerator() const {
// Simple Descriptor Constructors and other Methods
//===----------------------------------------------------------------------===//
-DIType::DIType(MDNode *N) : DIDescriptor(N) {
+DIType::DIType(MDNode *N) : DIScope(N) {
if (!N) return;
if (!isBasicType() && !isDerivedType() && !isCompositeType()) {
DbgNode = 0;
@@ -412,6 +412,8 @@ bool DISubprogram::describes(const Function *F) {
}
StringRef DIScope::getFilename() const {
+ if (!DbgNode)
+ return StringRef();
if (isLexicalBlock())
return DILexicalBlock(DbgNode).getFilename();
if (isSubprogram())
@@ -420,11 +422,15 @@ StringRef DIScope::getFilename() const {
return DICompileUnit(DbgNode).getFilename();
if (isNameSpace())
return DINameSpace(DbgNode).getFilename();
+ if (isType())
+ return DIType(DbgNode).getFilename();
assert(0 && "Invalid DIScope!");
return StringRef();
}
StringRef DIScope::getDirectory() const {
+ if (!DbgNode)
+ return StringRef();
if (isLexicalBlock())
return DILexicalBlock(DbgNode).getDirectory();
if (isSubprogram())
@@ -433,6 +439,8 @@ StringRef DIScope::getDirectory() const {
return DICompileUnit(DbgNode).getDirectory();
if (isNameSpace())
return DINameSpace(DbgNode).getDirectory();
+ if (isType())
+ return DIType(DbgNode).getDirectory();
assert(0 && "Invalid DIScope!");
return StringRef();
}
OpenPOWER on IntegriCloud