diff options
author | Chris Lattner <sabre@nondot.org> | 2007-08-26 05:02:07 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-08-26 05:02:07 +0000 |
commit | e7a160b37d520173009899c32b420dba8d605fa2 (patch) | |
tree | 1efe1bc52035afeb727bc634451ae953168446e9 /clang/CodeGen/CodeGenTypes.cpp | |
parent | cd995b0b4a3a151f4f223c80ba533e250cee9364 (diff) | |
download | bcm5719-llvm-e7a160b37d520173009899c32b420dba8d605fa2.tar.gz bcm5719-llvm-e7a160b37d520173009899c32b420dba8d605fa2.zip |
int X[] isn't a VLA. This improves support for stdio.h on darwin.
llvm-svn: 41423
Diffstat (limited to 'clang/CodeGen/CodeGenTypes.cpp')
-rw-r--r-- | clang/CodeGen/CodeGenTypes.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/CodeGen/CodeGenTypes.cpp b/clang/CodeGen/CodeGenTypes.cpp index 9fb1568a03e..8543cbd1d79 100644 --- a/clang/CodeGen/CodeGenTypes.cpp +++ b/clang/CodeGen/CodeGenTypes.cpp @@ -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 { |