Skip to content

Commit 04d0680

Browse files
committed
[NFC] IRGen: Extracted method.
1 parent f37d2a2 commit 04d0680

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

lib/IRGen/GenEnum.cpp

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1854,6 +1854,18 @@ namespace {
18541854
return func;
18551855
}
18561856

1857+
void emitCallToConsumeEnumFunction(IRGenFunction &IGF, Explosion &src,
1858+
SILType theEnumType) const {
1859+
if (!consumeEnumFunction)
1860+
consumeEnumFunction = emitConsumeEnumFunction(IGF.IGM, loweredType);
1861+
Explosion tmp;
1862+
fillExplosionForOutlinedCall(IGF, src, tmp);
1863+
llvm::CallInst *call = IGF.Builder.CreateCallWithoutDbgLoc(
1864+
consumeEnumFunction->getFunctionType(), consumeEnumFunction,
1865+
tmp.claimAll());
1866+
call->setCallingConv(IGM.DefaultCC);
1867+
}
1868+
18571869
llvm::Function *emitConsumeEnumFunction(IRGenModule &IGM,
18581870
SILType theEnumType) const {
18591871
IRGenMangler Mangler;
@@ -2806,14 +2818,7 @@ namespace {
28062818
IGF.Builder.emitBlock(endBB);
28072819
return;
28082820
}
2809-
if (!consumeEnumFunction)
2810-
consumeEnumFunction = emitConsumeEnumFunction(IGM, loweredType);
2811-
Explosion tmp;
2812-
fillExplosionForOutlinedCall(IGF, src, tmp);
2813-
llvm::CallInst *call = IGF.Builder.CreateCallWithoutDbgLoc(
2814-
consumeEnumFunction->getFunctionType(), consumeEnumFunction,
2815-
tmp.claimAll());
2816-
call->setCallingConv(IGM.DefaultCC);
2821+
emitCallToConsumeEnumFunction(IGF, src, loweredType);
28172822
return;
28182823
}
28192824

0 commit comments

Comments
 (0)