Skip to content

Commit 29c5ef3

Browse files
[Prototype] Mark main entry function as preserved
1 parent 4e9ba8c commit 29c5ef3

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

lib/Serialization/ModuleSummaryIndexer.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,10 @@ void FunctionSummaryIndexer::visitKeyPathInst(KeyPathInst *KPI) {
302302
}
303303

304304
bool shouldPreserveFunction(const SILFunction &F) {
305+
if (F.getName().equals(SWIFT_ENTRY_POINT_FUNCTION)) {
306+
return true;
307+
}
308+
305309
if (F.getRepresentation() == SILFunctionTypeRepresentation::ObjCMethod) {
306310
return true;
307311
}

tools/driver/cross_module_opt_main.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ static llvm::cl::opt<std::string>
3737

3838
static llvm::DenseSet<GUID> computePreservedGUIDs(ModuleSummaryIndex *summary) {
3939
llvm::DenseSet<GUID> Set(1);
40-
Set.insert(getGUIDFromUniqueName("main"));
4140
for (auto FI = summary->functions_begin(), FE = summary->functions_end();
4241
FI != FE; ++FI) {
4342
auto summary = FI->second.get();

0 commit comments

Comments
 (0)