int X[] isn't a VLA. This improves support for stdio.h on darwin.

llvm-svn: 41423
This commit is contained in:
Chris Lattner
2007-08-26 05:02:07 +00:00
parent cd995b0b4a
commit e7a160b37d

View File

@@ -90,8 +90,10 @@ const llvm::Type *CodeGenTypes::ConvertType(QualType T) {
"FIXME: We only handle trivial array types so far!");
llvm::APSInt Size(32);
if (A.getSizeExpr() &&
A.getSizeExpr()->isIntegerConstantExpr(Size, Context)) {
if (A.getSizeExpr() == 0) {
// int X[] -> [0 x int]
return llvm::ArrayType::get(ConvertType(A.getElementType()), 0);
} else if (A.getSizeExpr()->isIntegerConstantExpr(Size, Context)) {
const llvm::Type *EltTy = ConvertType(A.getElementType());
return llvm::ArrayType::get(EltTy, Size.getZExtValue());
} else {