[cfe-commits] r78434 - in /cfe/trunk: include/clang/AST/Expr.h lib/CodeGen/CGExprScalar.cpp lib/Sema/SemaExpr.cpp
Anders Carlsson
andersca at mac.com
Fri Aug 7 16:48:20 PDT 2009
Author: andersca
Date: Fri Aug 7 18:48:20 2009
New Revision: 78434
URL: http://llvm.org/viewvc/llvm-project?rev=78434&view=rev
Log:
Add a CK_ArrayToPointerDecay cast kind.
Modified:
cfe/trunk/include/clang/AST/Expr.h
cfe/trunk/lib/CodeGen/CGExprScalar.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp
Modified: cfe/trunk/include/clang/AST/Expr.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Expr.h?rev=78434&r1=78433&r2=78434&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Expr.h (original)
+++ cfe/trunk/include/clang/AST/Expr.h Fri Aug 7 18:48:20 2009
@@ -1181,7 +1181,10 @@
CK_Dynamic,
/// CK_ToUnion - Cast to union (GCC extension).
- CK_ToUnion
+ CK_ToUnion,
+
+ /// CK_ArrayToPointerDecay - Array to pointer decay.
+ CK_ArrayToPointerDecay
};
private:
Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=78434&r1=78433&r2=78434&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Fri Aug 7 18:48:20 2009
@@ -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
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=78434&r1=78433&r2=78434&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Fri Aug 7 18:48:20 2009
@@ -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);
}
}
More information about the cfe-commits
mailing list