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/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp
index b531616..5d85b7a 100644
--- a/lib/CodeGen/CodeGenModule.cpp
+++ b/lib/CodeGen/CodeGenModule.cpp
@@ -632,7 +632,8 @@
 
   // FIXME: This is silly; getTypeAlign should just work for incomplete arrays
   unsigned Align;
-  if (const IncompleteArrayType* IAT = D->getType()->getAsIncompleteArrayType())
+  if (const IncompleteArrayType* IAT =
+        Context.getAsIncompleteArrayType(D->getType()))
     Align = Context.getTypeAlign(IAT->getElementType());
   else
     Align = Context.getTypeAlign(D->getType());