[llvm-commits] CVS: llvm/lib/CodeGen/DwarfWriter.cpp MachineDebugInfo.cpp
Jim Laskey
jlaskey at apple.com
Thu Jul 13 08:28:08 PDT 2006
Changes in directory llvm/lib/CodeGen:
DwarfWriter.cpp updated: 1.68 -> 1.69
MachineDebugInfo.cpp updated: 1.45 -> 1.46
---
Log message:
Fixed a bug handling void function types.
Requires rebuild of llvm-gcc4 (touch llvm-debug.cpp.)
---
Diffs of the changes: (+21 -12)
DwarfWriter.cpp | 2 +-
MachineDebugInfo.cpp | 31 ++++++++++++++++++++-----------
2 files changed, 21 insertions(+), 12 deletions(-)
Index: llvm/lib/CodeGen/DwarfWriter.cpp
diff -u llvm/lib/CodeGen/DwarfWriter.cpp:1.68 llvm/lib/CodeGen/DwarfWriter.cpp:1.69
--- llvm/lib/CodeGen/DwarfWriter.cpp:1.68 Tue Jul 11 10:58:09 2006
+++ llvm/lib/CodeGen/DwarfWriter.cpp Thu Jul 13 10:27:42 2006
@@ -1413,7 +1413,7 @@
Ty->AddUInt(DW_AT_prototyped, DW_FORM_flag, 1);
// Add return type.
Ty->AddDIEntry(DW_AT_type, DW_FORM_ref4,
- NewType(Context, cast<TypeDesc>(Elements[0]), Unit));
+ NewType(Context, dyn_cast<TypeDesc>(Elements[0]), Unit));
// Add arguments.
for(unsigned i = 1, N = Elements.size(); i < N; ++i) {
Index: llvm/lib/CodeGen/MachineDebugInfo.cpp
diff -u llvm/lib/CodeGen/MachineDebugInfo.cpp:1.45 llvm/lib/CodeGen/MachineDebugInfo.cpp:1.46
--- llvm/lib/CodeGen/MachineDebugInfo.cpp:1.45 Tue Jul 11 10:58:09 2006
+++ llvm/lib/CodeGen/MachineDebugInfo.cpp Thu Jul 13 10:27:42 2006
@@ -223,16 +223,21 @@
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 @@
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);
More information about the llvm-commits
mailing list