зеркало из https://github.com/microsoft/clang.git
implement codegen support for implicit casts.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39831 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
d0d560a097
Коммит
d07eb3b5b4
|
@ -472,8 +472,10 @@ RValue CodeGenFunction::EmitExpr(const Expr *E) {
|
|||
return EmitExpr(cast<ParenExpr>(E)->getSubExpr());
|
||||
case Expr::UnaryOperatorClass:
|
||||
return EmitUnaryOperator(cast<UnaryOperator>(E));
|
||||
case Expr::ImplicitCastExprClass:
|
||||
return EmitCastExpr(cast<ImplicitCastExpr>(E)->getSubExpr(), E->getType());
|
||||
case Expr::CastExprClass:
|
||||
return EmitCastExpr(cast<CastExpr>(E));
|
||||
return EmitCastExpr(cast<CastExpr>(E)->getSubExpr(), E->getType());
|
||||
case Expr::CallExprClass:
|
||||
return EmitCallExpr(cast<CallExpr>(E));
|
||||
case Expr::BinaryOperatorClass:
|
||||
|
@ -518,16 +520,18 @@ RValue CodeGenFunction::EmitArraySubscriptExprRV(const ArraySubscriptExpr *E) {
|
|||
return RValue::get(Builder.CreateExtractElement(Base, Idx, "vecext"));
|
||||
}
|
||||
|
||||
|
||||
RValue CodeGenFunction::EmitCastExpr(const CastExpr *E) {
|
||||
// EmitCastExpr - Emit code for an explicit or implicit cast. Implicit casts
|
||||
// have to handle a more broad range of conversions than explicit casts, as they
|
||||
// handle things like function to ptr-to-function decay etc.
|
||||
RValue CodeGenFunction::EmitCastExpr(const Expr *Op, QualType DestTy) {
|
||||
QualType SrcTy;
|
||||
RValue Src = EmitExprWithUsualUnaryConversions(E->getSubExpr(), SrcTy);
|
||||
RValue Src = EmitExprWithUsualUnaryConversions(Op, SrcTy);
|
||||
|
||||
// If the destination is void, just evaluate the source.
|
||||
if (E->getType()->isVoidType())
|
||||
if (DestTy->isVoidType())
|
||||
return RValue::getAggregate(0);
|
||||
|
||||
return EmitConversion(Src, SrcTy, E->getType());
|
||||
return EmitConversion(Src, SrcTy, DestTy);
|
||||
}
|
||||
|
||||
RValue CodeGenFunction::EmitCallExpr(const CallExpr *E) {
|
||||
|
|
|
@ -313,7 +313,7 @@ public:
|
|||
RValue EmitFloatingLiteral(const FloatingLiteral *E);
|
||||
RValue EmitCharacterLiteral(const CharacterLiteral *E);
|
||||
|
||||
RValue EmitCastExpr(const CastExpr *E);
|
||||
RValue EmitCastExpr(const Expr *Op, QualType DestTy);
|
||||
RValue EmitCallExpr(const CallExpr *E);
|
||||
RValue EmitArraySubscriptExprRV(const ArraySubscriptExpr *E);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче