Skip to content

Commit 051965f

Browse files
authored
Merge pull request #11702 from gottesmm/pr-865d52d5d74dbdd085015ff761fb53e6c9614b8a
2 parents d3ec90d + df36e82 commit 051965f

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

lib/SILGen/SILGenBuilder.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,13 @@ ManagedValue SILGenBuilder::createSuperMethod(SILLocation loc,
686686
return ManagedValue::forUnmanaged(v);
687687
}
688688

689+
ManagedValue SILGenBuilder::
690+
createValueMetatype(SILLocation loc, SILType metatype,
691+
ManagedValue base) {
692+
SILValue v = createValueMetatype(loc, metatype, base.getValue());
693+
return ManagedValue::forUnmanaged(v);
694+
}
695+
689696
//===----------------------------------------------------------------------===//
690697
// Switch Enum Builder
691698
//===----------------------------------------------------------------------===//

lib/SILGen/SILGenBuilder.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,10 @@ class SILGenBuilder : public SILBuilder {
301301
ManagedValue createSuperMethod(SILLocation loc, ManagedValue operand,
302302
SILDeclRef member, SILType methodTy,
303303
bool isVolatile = false);
304+
305+
using SILBuilder::createValueMetatype;
306+
ManagedValue createValueMetatype(SILLocation loc, SILType metatype,
307+
ManagedValue base);
304308
};
305309

306310
class SwitchCaseFullExpr;

lib/SILGen/SILGenExpr.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2621,9 +2621,8 @@ SILValue SILGenFunction::emitMetatypeOfValue(SILLocation loc, Expr *baseExpr) {
26212621
// dynamically from the instance.
26222622
if (metaTy.castTo<MetatypeType>()->getRepresentation()
26232623
!= MetatypeRepresentation::Thin) {
2624-
auto base = emitRValueAsSingleValue(baseExpr,
2625-
SGFContext::AllowImmediatePlusZero).getValue();
2626-
return B.createValueMetatype(loc, metaTy, base);
2624+
auto base = emitRValueAsSingleValue(baseExpr, SGFContext::AllowImmediatePlusZero);
2625+
return B.createValueMetatype(loc, metaTy, base).getValue();
26272626
}
26282627

26292628
// Otherwise, ignore the base and return the static thin metatype.

0 commit comments

Comments
 (0)