aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaType.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2008-05-14 00:40:18 +0000
committerEli Friedman <eli.friedman@gmail.com>2008-05-14 00:40:18 +0000
commit37148aabe7d153ce682b5715a820a11c0bbfcd59 (patch)
treee5a5e7ca714f289f0a46ad1c9b8edec6040f806e /lib/Sema/SemaType.cpp
parent06e863f2902b8ba55b056308875c19f7ba3dab25 (diff)
An array of VLAs is a VLA. Shouldn't make any significant difference at
the moment, but it what you'd expect in the AST from reading the standard, and it should make VLA codegen a bit more strightforward. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51086 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaType.cpp')
-rw-r--r--lib/Sema/SemaType.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index 85ff96111a..9bb211bd30 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -339,10 +339,12 @@ QualType Sema::GetTypeForDeclarator(Declarator &D, Scope *S) {
ATI.NumElts = ArraySize = 0;
}
llvm::APSInt ConstVal(32);
- // If no expression was provided, we consider it an incomplete array.
if (!ArraySize) {
T = Context.getIncompleteArrayType(T, ASM, ATI.TypeQuals);
- } else if (!ArraySize->isIntegerConstantExpr(ConstVal, Context)) {
+ } else if (!ArraySize->isIntegerConstantExpr(ConstVal, Context) ||
+ !T->isConstantSizeType()) {
+ // Per C99, a variable array is an array with either a non-constant
+ // size or an element type that has a non-constant-size
T = Context.getVariableArrayType(T, ArraySize, ASM, ATI.TypeQuals);
} else {
// C99 6.7.5.2p1: If the expression is a constant expression, it shall