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/AST/Expr.cpp b/lib/AST/Expr.cpp
index 60b762f..21f2b07 100644
--- a/lib/AST/Expr.cpp
+++ b/lib/AST/Expr.cpp
@@ -466,14 +466,17 @@
   case LV_DuplicateVectorComponents: return MLV_DuplicateVectorComponents;
   case LV_InvalidExpression: return MLV_InvalidExpression;
   }
-  if (TR.isConstQualified())
+  
+  QualType CT = Ctx.getCanonicalType(getType());
+  
+  if (CT.isConstQualified())
     return MLV_ConstQualified;
-  if (TR->isArrayType())
+  if (CT->isArrayType())
     return MLV_ArrayType;
-  if (TR->isIncompleteType())
+  if (CT->isIncompleteType())
     return MLV_IncompleteType;
     
-  if (const RecordType *r = TR->getAsRecordType()) {
+  if (const RecordType *r = CT->getAsRecordType()) {
     if (r->hasConstFields()) 
       return MLV_ConstQualified;
   }