mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
AST: Remove unneeded expression nodes for __inout_conversion and __writeback_conversion.
We no longer need this language feature. The Sema support is still skeletally kept in place because removing it seems to totally break pointer conversions; I need to work with Joe and Doug to figure out why that's the case. Swift SVN r19289
This commit is contained in:
@@ -162,7 +162,6 @@ public:
|
||||
LValue visitMemberRefExpr(MemberRefExpr *e);
|
||||
LValue visitSubscriptExpr(SubscriptExpr *e);
|
||||
LValue visitTupleElementExpr(TupleElementExpr *e);
|
||||
LValue visitLValueConversionExpr(LValueConversionExpr *e);
|
||||
|
||||
// Expressions that wrap lvalues
|
||||
|
||||
@@ -444,55 +443,6 @@ namespace {
|
||||
}
|
||||
};
|
||||
|
||||
/// Convert an lvalue to a different type through a pair of conversion
|
||||
/// functions.
|
||||
class LValueConversionComponent : public LogicalPathComponent {
|
||||
LValueConversionExpr *Conversion;
|
||||
|
||||
public:
|
||||
LValueConversionComponent(LValueConversionExpr *E,
|
||||
LValueTypeData typeData)
|
||||
: LogicalPathComponent(typeData),
|
||||
Conversion(E)
|
||||
{}
|
||||
|
||||
ManagedValue get(SILGenFunction &gen, SILLocation loc,
|
||||
ManagedValue orig, SGFContext c) const override {
|
||||
// Load the original value.
|
||||
ManagedValue origVal = gen.emitLoad(loc, orig.getValue(),
|
||||
gen.getTypeLowering(orig.getType()),
|
||||
SGFContext(),
|
||||
IsNotTake);
|
||||
// Apply the "from" conversion.
|
||||
auto origTy = Conversion->getSubExpr()->getType()
|
||||
->getLValueOrInOutObjectType()
|
||||
->getCanonicalType();
|
||||
return gen.emitApplyConversionFunction(loc,
|
||||
Conversion->getFromConversionFn(),
|
||||
Conversion->getType()->getLValueOrInOutObjectType(),
|
||||
RValue(gen, loc, origTy, origVal));
|
||||
}
|
||||
|
||||
void set(SILGenFunction &gen, SILLocation loc,
|
||||
RValue &&value, ManagedValue origAddr) const override {
|
||||
// Apply the "to" conversion.
|
||||
ManagedValue convertedVal = gen.emitApplyConversionFunction(loc,
|
||||
Conversion->getToConversionFn(),
|
||||
Conversion->getSubExpr()->getType()->getLValueOrInOutObjectType(),
|
||||
std::move(value));
|
||||
|
||||
// Store back to the original value.
|
||||
convertedVal.assignInto(gen, loc, origAddr.getValue());
|
||||
}
|
||||
|
||||
std::unique_ptr<LogicalPathComponent>
|
||||
clone(SILGenFunction &gen, SILLocation loc) const override {
|
||||
LogicalPathComponent *clone
|
||||
= new LValueConversionComponent(Conversion, getTypeData());
|
||||
return std::unique_ptr<LogicalPathComponent>(clone);
|
||||
}
|
||||
};
|
||||
|
||||
/// Remap an lvalue referencing a generic type to an lvalue of its substituted
|
||||
/// type in a concrete context.
|
||||
class OrigToSubstComponent : public LogicalPathComponent {
|
||||
@@ -770,16 +720,6 @@ LValue SILGenLValue::visitTupleElementExpr(TupleElementExpr *e) {
|
||||
return std::move(lv);
|
||||
}
|
||||
|
||||
LValue SILGenLValue::visitLValueConversionExpr(LValueConversionExpr *e) {
|
||||
LValue lv = visitRec(e->getSubExpr());
|
||||
|
||||
LValueTypeData typeData = getMemberTypeData(gen,
|
||||
e->getType()->getLValueOrInOutObjectType(),
|
||||
e);
|
||||
lv.add<LValueConversionComponent>(e, typeData);
|
||||
return std::move(lv);
|
||||
}
|
||||
|
||||
LValue SILGenLValue::visitInOutExpr(InOutExpr *e) {
|
||||
return visitRec(e->getSubExpr());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user