зеркало из https://github.com/microsoft/clang-1.git
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
This commit is contained in:
Родитель
06e863f290
Коммит
37148aabe7
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче