forked from OSchip/llvm-project
Only reuse an already existing ImplicitCastExpr if the cast kinds are the same.
llvm-svn: 81841
This commit is contained in:
parent
e9a4992399
commit
4e66cda3f7
|
@ -230,9 +230,13 @@ void Sema::ImpCastExprToType(Expr *&Expr, QualType Ty,
|
|||
}
|
||||
|
||||
if (ImplicitCastExpr *ImpCast = dyn_cast<ImplicitCastExpr>(Expr)) {
|
||||
if (ImpCast->getCastKind() == Kind) {
|
||||
ImpCast->setType(Ty);
|
||||
ImpCast->setLvalueCast(isLvalue);
|
||||
} else
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Expr = new (Context) ImplicitCastExpr(Ty, Kind, Expr, isLvalue);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue