aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/DebugInfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Analysis/DebugInfo.cpp')
-rw-r--r--lib/Analysis/DebugInfo.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Analysis/DebugInfo.cpp b/lib/Analysis/DebugInfo.cpp
index 01db8abf4e..29175a6a2d 100644
--- a/lib/Analysis/DebugInfo.cpp
+++ b/lib/Analysis/DebugInfo.cpp
@@ -100,6 +100,14 @@ DIGlobalVariable::DIGlobalVariable(GlobalVariable *GV)
: DIGlobal(GV, dwarf::DW_TAG_variable) {}
DIBlock::DIBlock(GlobalVariable *GV)
: DIDescriptor(GV, dwarf::DW_TAG_lexical_block) {}
+// needed by DIVariable::getType()
+DIType::DIType(GlobalVariable *GV) : DIDescriptor(GV) {
+ if (!GV) return;
+ unsigned tag = getTag();
+ if (tag != dwarf::DW_TAG_base_type && !DIDerivedType::isDerivedType(tag) &&
+ !DICompositeType::isCompositeType(tag))
+ GV = 0;
+}
/// isDerivedType - Return true if the specified tag is legal for
/// DIDerivedType.