Revert r92318. Instead fix the analyzer: do not call 
ASTContext::hasSameUnqualifiedType() when one of the type is VariableArrayType.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92723 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index ad10aa3..fe96280 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -2383,7 +2383,6 @@
   assert(!T.hasQualifiers() && "canonical array type has qualifiers!");
   const ArrayType *AT = cast<ArrayType>(T);
   QualType Elt = AT->getElementType();
-  assert(Elt.isCanonical());
   QualType UnqualElt = getUnqualifiedArrayType(Elt, Quals);
   if (Elt == UnqualElt)
     return T;
@@ -2397,12 +2396,6 @@
     return getIncompleteArrayType(UnqualElt, IAT->getSizeModifier(), 0);
   }
 
-  if (const VariableArrayType *VAT = dyn_cast<VariableArrayType>(T)) {
-    return getVariableArrayType(UnqualElt, VAT->getSizeExpr()->Retain(),
-                                VAT->getSizeModifier(), 0,
-                                SourceRange());
-  }
-
   const DependentSizedArrayType *DSAT = cast<DependentSizedArrayType>(T);
   return getDependentSizedArrayType(UnqualElt, DSAT->getSizeExpr()->Retain(),
                                     DSAT->getSizeModifier(), 0,
diff --git a/lib/Analysis/SValuator.cpp b/lib/Analysis/SValuator.cpp
index 49bc0c4..0e56026 100644
--- a/lib/Analysis/SValuator.cpp
+++ b/lib/Analysis/SValuator.cpp
@@ -62,8 +62,9 @@
   ASTContext &C = ValMgr.getContext();
 
   // For const casts, just propagate the value.
-  if (C.hasSameUnqualifiedType(castTy, originalTy))
-    return CastResult(state, val);
+  if (!castTy->isVariableArrayType() && !originalTy->isVariableArrayType())
+    if (C.hasSameUnqualifiedType(castTy, originalTy))
+      return CastResult(state, val);
 
   // Check for casts from pointers to integers.
   if (castTy->isIntegerType() && Loc::IsLocType(originalTy))