summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorNuno Lopes <nunoplopes@sapo.pt>2009-01-28 00:35:17 +0000
committerNuno Lopes <nunoplopes@sapo.pt>2009-01-28 00:35:17 +0000
commitbb537dc189c33fedebaddc7ad1ab474136390427 (patch)
tree2722f7796c8ce1f87e0da7762330c27ed6efae13 /clang
parent5c04bd81edc00cb201d04e80ae45be50c4cf83db (diff)
downloadbcm5719-llvm-bb537dc189c33fedebaddc7ad1ab474136390427.tar.gz
bcm5719-llvm-bb537dc189c33fedebaddc7ad1ab474136390427.zip
fix PR3427: fix debuginfo for incomplete array types
llvm-svn: 63158
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp7
-rw-r--r--clang/test/CodeGen/debug-info.c8
2 files changed, 12 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index e0a52d61844..79abc340644 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -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);
diff --git a/clang/test/CodeGen/debug-info.c b/clang/test/CodeGen/debug-info.c
index f5a31631fba..2ecae9fa6d5 100644
--- a/clang/test/CodeGen/debug-info.c
+++ b/clang/test/CodeGen/debug-info.c
@@ -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;
OpenPOWER on IntegriCloud