Add a CK_FunctionToPointerDecay cast kind.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80719 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Anders Carlsson 2009-09-01 20:37:18 +00:00
Родитель 174754cda4
Коммит b633c4ee62
4 изменённых файлов: 9 добавлений и 2 удалений

Просмотреть файл

@ -1347,6 +1347,9 @@ public:
/// 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,

Просмотреть файл

@ -324,6 +324,9 @@ void StmtDumper::VisitCastExpr(CastExpr *Node) {
case CastExpr::CK_ArrayToPointerDecay:
fprintf(F, "<ArrayToPointerDecay>");
break;
case CastExpr::CK_FunctionToPointerDecay:
fprintf(F, "<FunctionToPointerDecay>");
break;
case CastExpr::CK_NullToMemberPointer:
fprintf(F, "<NullToMemberPointer>");
break;

Просмотреть файл

@ -196,7 +196,8 @@ void Sema::DefaultFunctionArrayConversion(Expr *&E) {
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

Просмотреть файл

@ -1016,7 +1016,7 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType,
FromType = From->getType();
}
FromType = Context.getPointerType(FromType);
ImpCastExprToType(From, FromType);
ImpCastExprToType(From, FromType, CastExpr::CK_FunctionToPointerDecay);
break;
default: