aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/MachineDebugInfo.cpp
diff options
context:
space:
mode:
authorJim Laskey <jlaskey@mac.com>2006-03-08 02:07:02 +0000
committerJim Laskey <jlaskey@mac.com>2006-03-08 02:07:02 +0000
commit2b0e309640c638025d83c8f6f4ee2698ba1b8b92 (patch)
tree523a3cb8c6cb697c9785dd59cbe99a6d69763b93 /lib/CodeGen/MachineDebugInfo.cpp
parent25de486263abc1882498a8701e3eb29ee0804c4e (diff)
libstdc++-v3 was failing to build. Needed to handle composite types with empty
members (running into a zero initializer.) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26607 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachineDebugInfo.cpp')
-rw-r--r--lib/CodeGen/MachineDebugInfo.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/CodeGen/MachineDebugInfo.cpp b/lib/CodeGen/MachineDebugInfo.cpp
index 9e76daa4b7..45ded8e426 100644
--- a/lib/CodeGen/MachineDebugInfo.cpp
+++ b/lib/CodeGen/MachineDebugInfo.cpp
@@ -263,12 +263,15 @@ public:
virtual void Apply(std::vector<DebugInfoDesc *> &Field) {
Constant *C = CI->getOperand(I++);
GlobalVariable *GV = getGlobalVariable(C);
- ConstantArray *CA = cast<ConstantArray>(GV->getInitializer());
Field.resize(0);
- for (unsigned i = 0, N = CA->getNumOperands(); i < N; ++i) {
- GlobalVariable *GVE = getGlobalVariable(CA->getOperand(i));
- DebugInfoDesc *DE = DR.Deserialize(GVE);
- Field.push_back(DE);
+ // Have to be able to deal with the empty array case (zero initializer)
+ if (!GV->hasInitializer()) return;
+ if (ConstantArray *CA = dyn_cast<ConstantArray>(GV->getInitializer())) {
+ for (unsigned i = 0, N = CA->getNumOperands(); i < N; ++i) {
+ GlobalVariable *GVE = getGlobalVariable(CA->getOperand(i));
+ DebugInfoDesc *DE = DR.Deserialize(GVE);
+ Field.push_back(DE);
+ }
}
}
};