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 | 78e30fb5d9b8cb39af8214935e1afeeea259cf76 (patch) | |
tree | 79bfe42e574767a315e3a1ec899522a720c8ae48 /CodeGen/CodeGenTypes.cpp | |
parent | 48a80946f5632bf7287984e3f7b515a336d43acd (diff) |
int X[] isn't a VLA. This improves support for stdio.h on darwin.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41423 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'CodeGen/CodeGenTypes.cpp')
-rw-r--r-- | CodeGen/CodeGenTypes.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/CodeGen/CodeGenTypes.cpp b/CodeGen/CodeGenTypes.cpp index 9fb1568a03..8543cbd1d7 100644 --- a/CodeGen/CodeGenTypes.cpp +++ b/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 { |