forked from OSchip/llvm-project
fix PR3427: fix debuginfo for incomplete array types
llvm-svn: 63158
This commit is contained in:
parent
5c04bd81ed
commit
bb537dc189
|
@ -337,11 +337,14 @@ llvm::DIType CGDebugInfo::CreateType(const ArrayType *Ty,
|
|||
uint64_t Align;
|
||||
|
||||
|
||||
// FIXME: make getTypeAlign() aware of VLAs and incomplete array types
|
||||
if (const VariableArrayType *VAT = dyn_cast<VariableArrayType>(Ty)) {
|
||||
|
||||
Size = 0;
|
||||
Align =
|
||||
M->getContext().getTypeSize(M->getContext().getBaseElementType(VAT));
|
||||
M->getContext().getTypeAlign(M->getContext().getBaseElementType(VAT));
|
||||
} else if (Ty->isIncompleteArrayType()) {
|
||||
Size = 0;
|
||||
Align = M->getContext().getTypeAlign(Ty->getElementType());
|
||||
} else {
|
||||
// Size and align of the whole array, not the element type.
|
||||
Size = M->getContext().getTypeSize(Ty);
|
||||
|
|
|
@ -18,7 +18,13 @@ struct s0 { struct s0 *p; } g0;
|
|||
struct s0 *f0(struct s0 *a0) {
|
||||
return a0->p;
|
||||
}
|
||||
|
||||
|
||||
// PR3134
|
||||
char xpto[];
|
||||
|
||||
// PR3427
|
||||
struct foo {
|
||||
int a;
|
||||
void *ptrs[];
|
||||
};
|
||||
struct foo bar;
|
||||
|
|
Loading…
Reference in New Issue