Add a CK_ArrayToPointerDecay cast kind.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78434 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp
index 0f8d38e..3a9ec7e 100644
--- a/lib/CodeGen/CGExprScalar.cpp
+++ b/lib/CodeGen/CGExprScalar.cpp
@@ -595,6 +595,7 @@
   // If this is due to array->pointer conversion, emit the array expression as
   // an l-value.
   if (Op->getType()->isArrayType()) {
+    assert(E->getCastKind() == CastExpr::CK_ArrayToPointerDecay);
     Value *V = EmitLValue(Op).getAddress();  // Bitfields can't be arrays.
 
     // Note that VLA pointers are always decayed, so we don't need to do
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 6f75b59..5d9b69c 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -209,7 +209,8 @@
     //
     if (getLangOptions().C99 || getLangOptions().CPlusPlus ||
         E->isLvalue(Context) == Expr::LV_Valid)
-      ImpCastExprToType(E, Context.getArrayDecayedType(Ty));
+      ImpCastExprToType(E, Context.getArrayDecayedType(Ty),
+                        CastExpr::CK_ArrayToPointerDecay);
   }
 }