]> granicus.if.org Git - clang/commitdiff
int X[] isn't a VLA. This improves support for stdio.h on darwin.
authorChris Lattner <sabre@nondot.org>
Sun, 26 Aug 2007 05:02:07 +0000 (05:02 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 26 Aug 2007 05:02:07 +0000 (05:02 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41423 91177308-0d34-0410-b5e6-96231b3b80d8

CodeGen/CodeGenTypes.cpp

index 9fb1568a03ec5c7086b9da360146c04f17df6aa2..8543cbd1d79b16d603459e7096a1a1600296b70c 100644 (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 {