Skip to content

Commit

Permalink
Merge pull request #8297 from gottesmm/add_getsubst_methods_to_argume…
Browse files Browse the repository at this point in the history
…ntsource

[silgen] Add helper methods to compute ArgumentSource::getSubst{RValue,}Type() as SILTypes.
  • Loading branch information
gottesmm committed Mar 24, 2017
2 parents ae5c682 + 001345e commit 73bc62c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/SILGen/ArgumentSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,3 +217,17 @@ void ArgumentSource::forwardInto(SILGenFunction &SGF,
auto substLoweredType = destTL.getLoweredType().getSwiftRValueType();
RValue(SGF, loc, substLoweredType, outputValue).forwardInto(SGF, loc, dest);
}

SILType ArgumentSource::getSILSubstRValueType(SILGenFunction &SGF) const & {
CanSILFunctionType funcType = SGF.F.getLoweredFunctionType();
CanType substType = getSubstType();
AbstractionPattern origType(funcType->getGenericSignature(), substType);
return SGF.getLoweredType(origType, substType);
}

SILType ArgumentSource::getSILSubstType(SILGenFunction &SGF) const & {
CanSILFunctionType funcType = SGF.F.getLoweredFunctionType();
CanType substType = getSubstType();
AbstractionPattern origType(funcType->getGenericSignature(), substType);
return SGF.getLoweredType(origType, substType);
}
4 changes: 4 additions & 0 deletions lib/SILGen/ArgumentSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ class ArgumentSource {
llvm_unreachable("bad kind");
}

SILType getSILSubstType(SILGenFunction &SGF) const &;

CanType getSubstRValueType() const & {
switch (StoredKind) {
case Kind::RValue:
Expand All @@ -190,6 +192,8 @@ class ArgumentSource {
llvm_unreachable("bad kind");
}

SILType getSILSubstRValueType(SILGenFunction &SGF) const &;

bool hasLValueType() const & {
switch (StoredKind) {
case Kind::RValue: return false;
Expand Down

0 comments on commit 73bc62c

Please sign in to comment.