aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-07-22 06:27:26 +0000
committerChris Lattner <sabre@nondot.org>2011-07-22 06:27:26 +0000
commite135b089d8f3aabe996fd0605b9cd9cda3629f60 (patch)
treefdbbc8637d6ca1ecc0fdb8fddd478d8c8aa2efeb /clang/lib/CodeGen
parent43cae026893a5925f662715a27792f79fc0617b7 (diff)
downloadllvm-e135b089d8f3aabe996fd0605b9cd9cda3629f60.zip
llvm-e135b089d8f3aabe996fd0605b9cd9cda3629f60.tar.gz
llvm-e135b089d8f3aabe996fd0605b9cd9cda3629f60.tar.bz2
fix PR10384: C++ allows external arrays of incomplete type as well.
Many thanks to Eli for reducing this great testcase. llvm-svn: 135752
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CodeGenTypes.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenTypes.cpp b/clang/lib/CodeGen/CodeGenTypes.cpp
index ee629ec..87b3da5 100644
--- a/clang/lib/CodeGen/CodeGenTypes.cpp
+++ b/clang/lib/CodeGen/CodeGenTypes.cpp
@@ -419,6 +419,14 @@ llvm::Type *CodeGenTypes::ConvertType(QualType T) {
case Type::ConstantArray: {
const ConstantArrayType *A = cast<ConstantArrayType>(Ty);
llvm::Type *EltTy = ConvertTypeForMem(A->getElementType());
+
+ // Lower arrays of undefined struct type to arrays of i8 just to have a
+ // concrete type.
+ if (!EltTy->isSized()) {
+ SkippedLayout = true;
+ EltTy = llvm::Type::getInt8Ty(getLLVMContext());
+ }
+
ResultType = llvm::ArrayType::get(EltTy, A->getSize().getZExtValue());
break;
}