зеркало из https://github.com/microsoft/clang-1.git
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:
Родитель
174754cda4
Коммит
b633c4ee62
|
@ -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:
|
||||
|
|
Загрузка…
Ссылка в новой задаче