fix PR3427: fix debuginfo for incomplete array types
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63158 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp
index e0a52d6..79abc34 100644
--- a/lib/CodeGen/CGDebugInfo.cpp
+++ b/lib/CodeGen/CGDebugInfo.cpp
@@ -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);