diff options
author | Jim Laskey <jlaskey@mac.com> | 2006-07-13 15:27:42 +0000 |
---|---|---|
committer | Jim Laskey <jlaskey@mac.com> | 2006-07-13 15:27:42 +0000 |
commit | 194bef7ff488a5d367bab211db83e2e1010f386c (patch) | |
tree | 031bec174d206845ad5e269d9cbe19e97d3856dc /llvm/lib/CodeGen/MachineDebugInfo.cpp | |
parent | b42a945fd213677e1c583995e51061e7dfa76024 (diff) | |
download | bcm5719-llvm-194bef7ff488a5d367bab211db83e2e1010f386c.tar.gz bcm5719-llvm-194bef7ff488a5d367bab211db83e2e1010f386c.zip |
Fixed a bug handling void function types.
Requires rebuild of llvm-gcc4 (touch llvm-debug.cpp.)
llvm-svn: 29131
Diffstat (limited to 'llvm/lib/CodeGen/MachineDebugInfo.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineDebugInfo.cpp | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/llvm/lib/CodeGen/MachineDebugInfo.cpp b/llvm/lib/CodeGen/MachineDebugInfo.cpp index 54fb1b923ca..fa2f57f0e0c 100644 --- a/llvm/lib/CodeGen/MachineDebugInfo.cpp +++ b/llvm/lib/CodeGen/MachineDebugInfo.cpp @@ -223,16 +223,21 @@ public: Field = getGlobalVariable(C); } virtual void Apply(std::vector<DebugInfoDesc *> &Field) { + Field.resize(0); Constant *C = CI->getOperand(I++); GlobalVariable *GV = getGlobalVariable(C); - Field.resize(0); - // 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); + if (GV->hasInitializer()) { + 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); + } + } else if (GV->getInitializer()->isNullValue()) { + if (const ArrayType *T = + dyn_cast<ArrayType>(GV->getType()->getElementType())) { + Field.resize(T->getNumElements()); + } } } } @@ -305,9 +310,13 @@ public: std::vector<Constant *> ArrayElements; for (unsigned i = 0, N = Field.size(); i < N; ++i) { - GlobalVariable *GVE = SR.Serialize(Field[i]); - Constant *CE = ConstantExpr::getCast(GVE, EmptyTy); - ArrayElements.push_back(cast<Constant>(CE)); + if (DebugInfoDesc *Element = Field[i]) { + GlobalVariable *GVE = SR.Serialize(Element); + Constant *CE = ConstantExpr::getCast(GVE, EmptyTy); + ArrayElements.push_back(cast<Constant>(CE)); + } else { + ArrayElements.push_back(ConstantPointerNull::get(EmptyTy)); + } } Constant *CA = ConstantArray::get(AT, ArrayElements); |