diff options
| author | Steve Naroff <snaroff@apple.com> | 2007-08-30 18:10:14 +0000 |
|---|---|---|
| committer | Steve Naroff <snaroff@apple.com> | 2007-08-30 18:10:14 +0000 |
| commit | 90dfdd577465826602b1d6875b390c7f77dce51d (patch) | |
| tree | 3501ee483b23c248d78ae4bdf7b959e252230264 /clang/Sema/SemaType.cpp | |
| parent | 98dbf0a3b8634f2ff59b6747c64dd431b30cd96d (diff) | |
| download | bcm5719-llvm-90dfdd577465826602b1d6875b390c7f77dce51d.tar.gz bcm5719-llvm-90dfdd577465826602b1d6875b390c7f77dce51d.zip | |
Polish yesterday's Array/ConstantArray/VariableArray rewrite, removing a couple FIXME's.
Refactored Array/VariableArray, moving SizeModifier/IndexTypeQuals back up to Array. These
attributes are not specific to VLA's. Most of them are specific to array parameter types.
llvm-svn: 41616
Diffstat (limited to 'clang/Sema/SemaType.cpp')
| -rw-r--r-- | clang/Sema/SemaType.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/clang/Sema/SemaType.cpp b/clang/Sema/SemaType.cpp index 3bc0e760ba9..d1d62a6ea20 100644 --- a/clang/Sema/SemaType.cpp +++ b/clang/Sema/SemaType.cpp @@ -202,8 +202,13 @@ QualType Sema::GetTypeForDeclarator(Declarator &D, Scope *S) { D.setInvalidType(true); } } - T = Context.getArrayType(T, ASM, ATI.TypeQuals, ArraySize); - + llvm::APSInt ConstVal(32); + // If no expression was provided, we consider it a VLA. + if (!ArraySize || !ArraySize->isIntegerConstantExpr(ConstVal, Context)) + T = Context.getVariableArrayType(T, ArraySize, ASM, ATI.TypeQuals); + else + T = Context.getConstantArrayType(T, ConstVal, ASM, ATI.TypeQuals); + // If this is not C99, extwarn about VLA's and C99 array size modifiers. if (!getLangOptions().C99 && (ASM != ArrayType::Normal || |

