summaryrefslogtreecommitdiffstats
path: root/clang/CodeGen/CodeGenTypes.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-08-26 05:02:07 +0000
committerChris Lattner <sabre@nondot.org>2007-08-26 05:02:07 +0000
commite7a160b37d520173009899c32b420dba8d605fa2 (patch)
tree1efe1bc52035afeb727bc634451ae953168446e9 /clang/CodeGen/CodeGenTypes.cpp
parentcd995b0b4a3a151f4f223c80ba533e250cee9364 (diff)
downloadbcm5719-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.cpp6
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 {
OpenPOWER on IntegriCloud