[cfe-commits] r80719 - in /cfe/trunk: include/clang/AST/Expr.h lib/AST/StmtDumper.cpp lib/Sema/SemaExpr.cpp lib/Sema/SemaExprCXX.cpp
Anders Carlsson
andersca at mac.com
Tue Sep 1 13:37:19 PDT 2009
Author: andersca
Date: Tue Sep 1 15:37:18 2009
New Revision: 80719
URL: http://llvm.org/viewvc/llvm-project?rev=80719&view=rev
Log:
Add a CK_FunctionToPointerDecay cast kind.
Modified:
cfe/trunk/include/clang/AST/Expr.h
cfe/trunk/lib/AST/StmtDumper.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/lib/Sema/SemaExprCXX.cpp
Modified: cfe/trunk/include/clang/AST/Expr.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Expr.h?rev=80719&r1=80718&r2=80719&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Expr.h (original)
+++ cfe/trunk/include/clang/AST/Expr.h Tue Sep 1 15:37:18 2009
@@ -1347,6 +1347,9 @@
/// CK_ArrayToPointerDecay - Array to pointer decay.
CK_ArrayToPointerDecay,
+ // CK_FunctionToPointerDecay - Function to pointer decay.
+ CK_FunctionToPointerDecay,
+
/// CK_NullToMemberPointer - Null pointer to member pointer.
CK_NullToMemberPointer,
Modified: cfe/trunk/lib/AST/StmtDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtDumper.cpp?rev=80719&r1=80718&r2=80719&view=diff
==============================================================================
--- cfe/trunk/lib/AST/StmtDumper.cpp (original)
+++ cfe/trunk/lib/AST/StmtDumper.cpp Tue Sep 1 15:37:18 2009
@@ -324,6 +324,9 @@
case CastExpr::CK_ArrayToPointerDecay:
fprintf(F, "<ArrayToPointerDecay>");
break;
+ case CastExpr::CK_FunctionToPointerDecay:
+ fprintf(F, "<FunctionToPointerDecay>");
+ break;
case CastExpr::CK_NullToMemberPointer:
fprintf(F, "<NullToMemberPointer>");
break;
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=80719&r1=80718&r2=80719&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Tue Sep 1 15:37:18 2009
@@ -196,7 +196,8 @@
assert(!Ty.isNull() && "DefaultFunctionArrayConversion - missing type");
if (Ty->isFunctionType())
- ImpCastExprToType(E, Context.getPointerType(Ty));
+ ImpCastExprToType(E, Context.getPointerType(Ty),
+ CastExpr::CK_FunctionToPointerDecay);
else if (Ty->isArrayType()) {
// In C90 mode, arrays only promote to pointers if the array expression is
// an lvalue. The relevant legalese is C90 6.2.2.1p3: "an lvalue that has
Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=80719&r1=80718&r2=80719&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Tue Sep 1 15:37:18 2009
@@ -1016,7 +1016,7 @@
FromType = From->getType();
}
FromType = Context.getPointerType(FromType);
- ImpCastExprToType(From, FromType);
+ ImpCastExprToType(From, FromType, CastExpr::CK_FunctionToPointerDecay);
break;
default:
More information about the cfe-commits
mailing list