@@ -374,12 +374,16 @@ class SILCloner : protected SILInstructionVisitor<ImplClass> {
374374
375375 // / This is called by either of the top-level visitors, cloneReachableBlocks
376376 // / or cloneSILFunction, after all other visitors are have been called.
377+
378+ // / `preFixUp` is called first.
379+ void preFixUp (SILFunction *F) {}
380+ // / After postFixUp, the SIL must be valid and semantically equivalent to the
381+ // / SIL before cloning.
377382 // /
378- // / After fixUp, the SIL must be valid and semantically equivalent to the SIL
379- // / before cloning.
380- // /
381- // / Common fix-ups are handled first in `doFixUp` and may not be overridden.
382- void fixUp (SILFunction *F) {}
383+ // / Common fix-ups are handled first in `commonFixUp` and may not be
384+ // / overridden.
385+ void postFixUp (SILFunction *F) {}
386+
383387private:
384388 // / MARK: SILCloner implementation details hidden from CRTP extensions.
385389
@@ -388,8 +392,8 @@ class SILCloner : protected SILInstructionVisitor<ImplClass> {
388392 void visitBlocksDepthFirst (SILBasicBlock *StartBB);
389393
390394 // / Also perform fundamental cleanup first, then call the CRTP extension,
391- // / `fixUp `.
392- void doFixUp (SILFunction *F);
395+ // / `postFixUp `.
396+ void commonFixUp (SILFunction *F);
393397};
394398
395399// / A SILBuilder that automatically invokes postprocess on each
@@ -581,7 +585,7 @@ void SILCloner<ImplClass>::cloneReachableBlocks(
581585 // Discover and map the region to be cloned.
582586 visitBlocksDepthFirst (startBB);
583587
584- doFixUp (F);
588+ commonFixUp (F);
585589}
586590
587591template <typename ImplClass>
@@ -606,7 +610,7 @@ void SILCloner<ImplClass>::cloneFunctionBody(SILFunction *F,
606610 // This will layout all newly cloned blocks immediate after clonedEntryBB.
607611 visitBlocksDepthFirst (&*F->begin ());
608612
609- doFixUp (F);
613+ commonFixUp (F);
610614}
611615
612616template <typename ImplClass>
@@ -709,9 +713,11 @@ void SILCloner<ImplClass>::visitBlocksDepthFirst(SILBasicBlock *startBB) {
709713}
710714
711715// / Clean-up after cloning.
712- template <typename ImplClass>
713- void
714- SILCloner<ImplClass>::doFixUp(SILFunction *F) {
716+ template <typename ImplClass>
717+ void SILCloner<ImplClass>::commonFixUp(SILFunction *F) {
718+ // Call any cleanup specific to the CRTP extensions.
719+ asImpl ().preFixUp (F);
720+
715721 // If our source function is in ossa form, but the function into which we are
716722 // cloning is not in ossa, after we clone, eliminate default arguments.
717723 if (!getBuilder ().hasOwnership () && F->hasOwnership ()) {
@@ -745,7 +751,7 @@ SILCloner<ImplClass>::doFixUp(SILFunction *F) {
745751 }
746752
747753 // Call any cleanup specific to the CRTP extensions.
748- asImpl ().fixUp (F);
754+ asImpl ().postFixUp (F);
749755}
750756
751757template <typename ImplClass>
0 commit comments