[cfe-commits] r63158 - in /cfe/trunk: lib/CodeGen/CGDebugInfo.cpp test/CodeGen/debug-info.c
Nuno Lopes
nunoplopes at sapo.pt
Tue Jan 27 16:35:17 PST 2009
Author: nlopes
Date: Tue Jan 27 18:35:17 2009
New Revision: 63158
URL: http://llvm.org/viewvc/llvm-project?rev=63158&view=rev
Log:
fix PR3427: fix debuginfo for incomplete array types
Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/test/CodeGen/debug-info.c
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=63158&r1=63157&r2=63158&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Tue Jan 27 18:35:17 2009
@@ -337,11 +337,14 @@
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);
Modified: cfe/trunk/test/CodeGen/debug-info.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/debug-info.c?rev=63158&r1=63157&r2=63158&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/debug-info.c (original)
+++ cfe/trunk/test/CodeGen/debug-info.c Tue Jan 27 18:35:17 2009
@@ -18,7 +18,13 @@
struct s0 *f0(struct s0 *a0) {
return a0->p;
}
-
+
// PR3134
char xpto[];
+// PR3427
+struct foo {
+ int a;
+ void *ptrs[];
+};
+struct foo bar;
More information about the cfe-commits
mailing list