зеркало из https://github.com/microsoft/clang-1.git
Only reuse an already existing ImplicitCastExpr if the cast kinds are the same.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81841 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
c0a2fd8f09
Коммит
4c5fad3f73
|
@ -230,10 +230,14 @@ void Sema::ImpCastExprToType(Expr *&Expr, QualType Ty,
|
|||
}
|
||||
|
||||
if (ImplicitCastExpr *ImpCast = dyn_cast<ImplicitCastExpr>(Expr)) {
|
||||
ImpCast->setType(Ty);
|
||||
ImpCast->setLvalueCast(isLvalue);
|
||||
} else
|
||||
Expr = new (Context) ImplicitCastExpr(Ty, Kind, Expr, isLvalue);
|
||||
if (ImpCast->getCastKind() == Kind) {
|
||||
ImpCast->setType(Ty);
|
||||
ImpCast->setLvalueCast(isLvalue);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Expr = new (Context) ImplicitCastExpr(Ty, Kind, Expr, isLvalue);
|
||||
}
|
||||
|
||||
void Sema::DeleteExpr(ExprTy *E) {
|
||||
|
|
|
@ -991,9 +991,15 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType,
|
|||
if (CastArg.isInvalid())
|
||||
return true;
|
||||
|
||||
From = new (Context) ImplicitCastExpr(ToType.getNonReferenceType(),
|
||||
CastKind, CastArg.takeAs<Expr>(),
|
||||
ToType->isLValueReferenceType());
|
||||
QualType CastArgType = ((Expr *)CastArg.get())->getType();
|
||||
From =
|
||||
new (Context) ImplicitCastExpr(CastArgType, CastKind,
|
||||
CastArg.takeAs<Expr>(),
|
||||
CastArgType->isLValueReferenceType());
|
||||
if (PerformImplicitConversion(From, ToType.getNonReferenceType(),
|
||||
ICS.UserDefined.After, "converting"))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче