summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaInit.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-08-04 07:31:14 +0000
committerChris Lattner <sabre@nondot.org>2008-08-04 07:31:14 +0000
commit7adf07608847865d47fa50640c3b18007953c4aa (patch)
tree263f2ca4985a4e008e230fee9d2e6c4794075625 /clang/lib/Sema/SemaInit.cpp
parenta01ede2f1105780926d58af04d0e4db09140221f (diff)
downloadbcm5719-llvm-7adf07608847865d47fa50640c3b18007953c4aa.tar.gz
bcm5719-llvm-7adf07608847865d47fa50640c3b18007953c4aa.zip
Finally fix PR2189. This makes a fairly invasive but important change to
move getAsArrayType into ASTContext instead of being a method on type. This is required because getAsArrayType(const AT), where AT is a typedef for "int[10]" needs to return ArrayType(const int, 10). Fixing this greatly simplifies getArrayDecayedType, which is a good sign. llvm-svn: 54317
Diffstat (limited to 'clang/lib/Sema/SemaInit.cpp')
-rw-r--r--clang/lib/Sema/SemaInit.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index 0078cc149cd..1889bafacb0 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/lib/Sema/SemaInit.cpp
@@ -30,7 +30,8 @@ InitListChecker::InitListChecker(Sema *S, InitListExpr *IL, QualType &T) {
int InitListChecker::numArrayElements(QualType DeclType) {
// FIXME: use a proper constant
int maxElements = 0x7FFFFFFF;
- if (const ConstantArrayType *CAT = DeclType->getAsConstantArrayType()) {
+ if (const ConstantArrayType *CAT =
+ SemaRef->Context.getAsConstantArrayType(DeclType)) {
maxElements = static_cast<int>(CAT->getSize().getZExtValue());
}
return maxElements;
@@ -231,7 +232,8 @@ void InitListChecker::CheckArrayType(InitListExpr *IList, QualType &DeclType,
return;
}
}
- if (const VariableArrayType *VAT = DeclType->getAsVariableArrayType()) {
+ if (const VariableArrayType *VAT =
+ SemaRef->Context.getAsVariableArrayType(DeclType)) {
// Check for VLAs; in standard C it would be possible to check this
// earlier, but I don't know where clang accepts VLAs (gcc accepts
// them in all sorts of strange places).
@@ -243,7 +245,8 @@ void InitListChecker::CheckArrayType(InitListExpr *IList, QualType &DeclType,
}
int maxElements = numArrayElements(DeclType);
- QualType elementType = DeclType->getAsArrayType()->getElementType();
+ QualType elementType = SemaRef->Context.getAsArrayType(DeclType)
+ ->getElementType();
int numElements = 0;
for (int i = 0; i < maxElements; ++i, ++numElements) {
// Don't attempt to go past the end of the init list
OpenPOWER on IntegriCloud