Skip to content

Commit 53ac896

Browse files
authored
Merge pull request #61770 from tshortli/fix-sil-silgen-circular-dependency
Interop: Untangle circular dependency introduced by #59787
2 parents 83e9c5c + f5d760e commit 53ac896

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

include/swift/SIL/SILFunction.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,8 +520,6 @@ class SILFunction
520520
return ReplacedFunction;
521521
}
522522

523-
static SILFunction *getFunction(SILDeclRef ref, SILModule &M);
524-
525523
void setDynamicallyReplacedFunction(SILFunction *f) {
526524
assert(ReplacedFunction == nullptr && "already set");
527525
assert(!hasObjCReplacement());

lib/IRGen/IRABIDetailsProvider.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
#include "IRGenModule.h"
2121
#include "NativeConventionSchema.h"
2222

23+
// FIXME: This include should removed once getFunctionLoweredSignature() is
24+
// updated to take a different approach.
25+
#include "../SILGen/SILGen.h"
26+
2327
#include "swift/AST/ASTContext.h"
2428
#include "swift/AST/IRGenOptions.h"
2529
#include "swift/AST/ParameterList.h"
@@ -126,7 +130,10 @@ class IRABIDetailsProviderImpl {
126130

127131
llvm::Optional<LoweredFunctionSignature>
128132
getFunctionLoweredSignature(AbstractFunctionDecl *fd) {
129-
auto function = SILFunction::getFunction(SILDeclRef(fd), *silMod);
133+
auto declRef = SILDeclRef(fd);
134+
auto function = Lowering::SILGenModule(*silMod, declRef.getModuleContext())
135+
.getFunction(declRef, swift::NotForDefinition);
136+
130137
IGM.lowerSILFunction(function);
131138
auto silFuncType = function->getLoweredFunctionType();
132139
// FIXME: Async function support.

lib/SIL/IR/SILFunction.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,18 @@
1616
#include "swift/SIL/SILBasicBlock.h"
1717
#include "swift/SIL/SILBridgingUtils.h"
1818
#include "swift/SIL/SILCloner.h"
19+
#include "swift/SIL/SILDeclRef.h"
1920
#include "swift/SIL/SILFunction.h"
2021
#include "swift/SIL/SILInstruction.h"
2122
#include "swift/SIL/SILModule.h"
2223
#include "swift/SIL/SILProfiler.h"
2324
#include "swift/SIL/CFG.h"
2425
#include "swift/SIL/PrettyStackTrace.h"
25-
#include "../../SILGen/SILGen.h"
2626
#include "swift/AST/Availability.h"
2727
#include "swift/AST/GenericEnvironment.h"
28+
#include "swift/AST/Expr.h"
2829
#include "swift/AST/Module.h"
30+
#include "swift/AST/Stmt.h"
2931
#include "swift/Basic/OptimizationMode.h"
3032
#include "swift/Basic/Statistic.h"
3133
#include "swift/Basic/BridgingUtils.h"
@@ -1030,8 +1032,3 @@ SILInstruction::MemoryBehavior SILFunction::getMemoryBehavior(bool observeRetain
10301032
auto b = getMemBehvaiorFunction({this}, observeRetains);
10311033
return (SILInstruction::MemoryBehavior)b;
10321034
}
1033-
1034-
SILFunction *SILFunction::getFunction(SILDeclRef ref, SILModule &M) {
1035-
swift::Lowering::SILGenModule SILGenModule(M, ref.getModuleContext());
1036-
return SILGenModule.getFunction(ref, swift::NotForDefinition);
1037-
}

0 commit comments

Comments
 (0)