Skip to content

Commit af5d611

Browse files
Merge pull request #64583 from nate-chandler/rdar79508092
[SILGen] Use decl location for main's functions.
2 parents bdbab35 + 8c4a0ae commit af5d611

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/SILGen/SILGen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1106,7 +1106,7 @@ void SILGenModule::emitFunctionDefinition(SILDeclRef constant, SILFunction *f) {
11061106

11071107
// TODO: Handle main SourceFile emission (currently done by
11081108
// SourceFileScope).
1109-
auto loc = RegularLocation::getModuleLocation();
1109+
auto loc = constant.getAsRegularLocation();
11101110
preEmitFunction(constant, f, loc);
11111111
auto *decl = constant.getDecl();
11121112
auto *dc = decl->getDeclContext();

lib/SILGen/SILGenFunction.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -914,7 +914,7 @@ void SILGenFunction::emitArtificialTopLevel(Decl *mainDecl) {
914914
// Emit a call to the main static function.
915915
// return Module.$main();
916916
auto *mainFunc = cast<FuncDecl>(mainDecl);
917-
auto moduleLoc = RegularLocation::getModuleLocation();
917+
auto moduleLoc = SILLocation(mainDecl);
918918
auto *entryBlock = B.getInsertionBB();
919919

920920
SILDeclRef mainFunctionDeclRef(mainFunc, SILDeclRef::Kind::Func);
@@ -1001,7 +1001,7 @@ void SILGenFunction::emitArtificialTopLevel(Decl *mainDecl) {
10011001
}
10021002

10031003
void SILGenFunction::emitAsyncMainThreadStart(SILDeclRef entryPoint) {
1004-
auto moduleLoc = RegularLocation::getModuleLocation();
1004+
auto moduleLoc = entryPoint.getAsRegularLocation();
10051005
auto *entryBlock = B.getInsertionBB();
10061006
auto paramTypeIter = F.getConventions()
10071007
.getParameterSILTypes(getTypeExpansionContext())

0 commit comments

Comments
 (0)