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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54317 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 56632d1..6c6d6e2 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -1055,7 +1055,7 @@
   Expr *literalExpr = static_cast<Expr*>(InitExpr);
 
   if (literalType->isArrayType()) {
-    if (literalType->getAsVariableArrayType())
+    if (literalType->isVariableArrayType())
       return Diag(LParenLoc,
                   diag::err_variable_object_no_init,
                   SourceRange(LParenLoc,
@@ -2381,7 +2381,7 @@
     const OffsetOfComponent &OC = CompPtr[i];
     if (OC.isBrackets) {
       // Offset of an array sub-field.  TODO: Should we allow vector elements?
-      const ArrayType *AT = Res->getType()->getAsArrayType();
+      const ArrayType *AT = Context.getAsArrayType(Res->getType());
       if (!AT) {
         delete Res;
         return Diag(OC.LocEnd, diag::err_offsetof_array_type,