[PATCH] When an array is created that is too large, lower its size to the maximum allowable size.

Richard Smith richard at metafoo.co.uk
Wed May 15 17:10:45 PDT 2013



================
Comment at: lib/Sema/SemaType.cpp:1564-1567
@@ -1555,2 +1563,6 @@
           << ArraySize->getSourceRange();
+        // Set array size to largest allowable size.
+        getMaxArraySize(Context, T, ConstantArrayType::getMaxSizeBits(Context),
+                        ConstVal);
+      }
     }
----------------
How about just returning QualType() here? An invalid type should do a better job of suppressing follow-on diagnostics than an array-of-unexpected-size.


http://llvm-reviews.chandlerc.com/D800



More information about the cfe-commits mailing list