@@ -1074,20 +1074,19 @@ static bool performCompileStepsPostSILGen(CompilerInstance &Instance,
1074
1074
std::unique_ptr<SILModule> SM,
1075
1075
ModuleOrSourceFile MSF,
1076
1076
const PrimarySpecificPaths &PSPs,
1077
- bool moduleIsPublic, int &ReturnValue,
1077
+ int &ReturnValue,
1078
1078
FrontendObserver *observer);
1079
1079
1080
- static bool
1081
- performCompileStepsPostSema (const CompilerInvocation &Invocation,
1082
- CompilerInstance &Instance,
1083
- bool moduleIsPublic, int &ReturnValue,
1084
- FrontendObserver *observer) {
1080
+ static bool performCompileStepsPostSema (const CompilerInvocation &Invocation,
1081
+ CompilerInstance &Instance,
1082
+ int &ReturnValue,
1083
+ FrontendObserver *observer) {
1085
1084
auto mod = Instance.getMainModule ();
1086
1085
if (auto SM = Instance.takeSILModule ()) {
1087
1086
const PrimarySpecificPaths PSPs =
1088
1087
Instance.getPrimarySpecificPathsForAtMostOnePrimary ();
1089
1088
return performCompileStepsPostSILGen (Instance, Invocation, std::move (SM),
1090
- mod, PSPs, moduleIsPublic,
1089
+ mod, PSPs,
1091
1090
ReturnValue, observer);
1092
1091
}
1093
1092
@@ -1100,7 +1099,7 @@ performCompileStepsPostSema(const CompilerInvocation &Invocation,
1100
1099
const PrimarySpecificPaths PSPs =
1101
1100
Instance.getPrimarySpecificPathsForWholeModuleOptimizationMode ();
1102
1101
return performCompileStepsPostSILGen (Instance, Invocation, std::move (SM),
1103
- mod, PSPs, moduleIsPublic,
1102
+ mod, PSPs,
1104
1103
ReturnValue, observer);
1105
1104
}
1106
1105
// If there are primary source files, build a separate SILModule for
@@ -1113,7 +1112,7 @@ performCompileStepsPostSema(const CompilerInvocation &Invocation,
1113
1112
const PrimarySpecificPaths PSPs =
1114
1113
Instance.getPrimarySpecificPathsForSourceFile (*PrimaryFile);
1115
1114
result |= performCompileStepsPostSILGen (Instance, Invocation, std::move (SM),
1116
- PrimaryFile, PSPs, moduleIsPublic,
1115
+ PrimaryFile, PSPs,
1117
1116
ReturnValue, observer);
1118
1117
}
1119
1118
@@ -1131,7 +1130,7 @@ performCompileStepsPostSema(const CompilerInvocation &Invocation,
1131
1130
const PrimarySpecificPaths &PSPs =
1132
1131
Instance.getPrimarySpecificPathsForPrimary (SASTF->getFilename ());
1133
1132
result |= performCompileStepsPostSILGen (Instance, Invocation, std::move (SM),
1134
- mod, PSPs, moduleIsPublic,
1133
+ mod, PSPs,
1135
1134
ReturnValue, observer);
1136
1135
}
1137
1136
}
@@ -1158,8 +1157,7 @@ emitIndexData(const CompilerInvocation &Invocation, const CompilerInstance &Inst
1158
1157
// / `-typecheck`, but skipped for any mode that runs SIL diagnostics if there's
1159
1158
// / an error found there (to get those diagnostics back to the user faster).
1160
1159
static bool emitAnyWholeModulePostTypeCheckSupplementaryOutputs (
1161
- CompilerInstance &Instance, const CompilerInvocation &Invocation,
1162
- bool moduleIsPublic) {
1160
+ CompilerInstance &Instance, const CompilerInvocation &Invocation) {
1163
1161
const FrontendOptions &opts = Invocation.getFrontendOptions ();
1164
1162
1165
1163
// Record whether we failed to emit any of these outputs, but keep going; one
@@ -1182,7 +1180,8 @@ static bool emitAnyWholeModulePostTypeCheckSupplementaryOutputs(
1182
1180
}
1183
1181
hadAnyError |= printAsObjCIfNeeded (
1184
1182
Invocation.getObjCHeaderOutputPathForAtMostOnePrimary (),
1185
- Instance.getMainModule (), BridgingHeaderPathForPrint, moduleIsPublic);
1183
+ Instance.getMainModule (), BridgingHeaderPathForPrint,
1184
+ Invocation.isModuleExternallyConsumed (Instance.getMainModule ()));
1186
1185
}
1187
1186
1188
1187
if (opts.InputsAndOutputs .hasModuleInterfaceOutputPath ()) {
@@ -1315,13 +1314,6 @@ static bool performCompile(CompilerInstance &Instance,
1315
1314
(void )emitLoadedModuleTraceForAllPrimariesIfNeeded (
1316
1315
Instance.getMainModule (), Instance.getDependencyTracker (), opts);
1317
1316
1318
- // FIXME: This is still a lousy approximation of whether the module file will
1319
- // be externally consumed.
1320
- bool moduleIsPublic =
1321
- !Instance.getMainModule ()->hasEntryPoint () &&
1322
- opts.ImplicitObjCHeaderPath .empty () &&
1323
- !Context.LangOpts .EnableAppExtensionRestrictions ;
1324
-
1325
1317
// We've just been told to perform a typecheck, so we can return now.
1326
1318
if (Action == FrontendOptions::ActionType::Typecheck) {
1327
1319
if (emitIndexData (Invocation, Instance))
@@ -1336,8 +1328,7 @@ static bool performCompile(CompilerInstance &Instance,
1336
1328
// guarding the emission of whole-module supplementary outputs.
1337
1329
if (opts.InputsAndOutputs .isWholeModule ()) {
1338
1330
if (emitAnyWholeModulePostTypeCheckSupplementaryOutputs (Instance,
1339
- Invocation,
1340
- moduleIsPublic)) {
1331
+ Invocation)) {
1341
1332
return true ;
1342
1333
}
1343
1334
}
@@ -1347,8 +1338,8 @@ static bool performCompile(CompilerInstance &Instance,
1347
1338
assert (FrontendOptions::doesActionGenerateSIL (Action) &&
1348
1339
" All actions not requiring SILGen must have been handled!" );
1349
1340
1350
- return performCompileStepsPostSema (Invocation, Instance, moduleIsPublic ,
1351
- ReturnValue, observer);
1341
+ return performCompileStepsPostSema (Invocation, Instance, ReturnValue ,
1342
+ observer);
1352
1343
}
1353
1344
1354
1345
static bool serializeSIB (SILModule *SM, const PrimarySpecificPaths &PSPs,
@@ -1575,9 +1566,8 @@ static bool performCompileStepsPostSILGen(CompilerInstance &Instance,
1575
1566
std::unique_ptr<SILModule> SM,
1576
1567
ModuleOrSourceFile MSF,
1577
1568
const PrimarySpecificPaths &PSPs,
1578
- bool moduleIsPublic, int &ReturnValue,
1569
+ int &ReturnValue,
1579
1570
FrontendObserver *observer) {
1580
-
1581
1571
FrontendOptions opts = Invocation.getFrontendOptions ();
1582
1572
FrontendOptions::ActionType Action = opts.RequestedAction ;
1583
1573
const ASTContext &Context = Instance.getASTContext ();
@@ -1618,7 +1608,7 @@ static bool performCompileStepsPostSILGen(CompilerInstance &Instance,
1618
1608
return ;
1619
1609
1620
1610
SerializationOptions serializationOpts =
1621
- Invocation.computeSerializationOptions (outs, moduleIsPublic );
1611
+ Invocation.computeSerializationOptions (outs, Instance. getMainModule () );
1622
1612
serialize (MSF, serializationOpts, SM.get ());
1623
1613
};
1624
1614
@@ -1633,8 +1623,7 @@ static bool performCompileStepsPostSILGen(CompilerInstance &Instance,
1633
1623
if (observer)
1634
1624
observer->performedSILProcessing (*SM);
1635
1625
1636
- emitAnyWholeModulePostTypeCheckSupplementaryOutputs (Instance, Invocation,
1637
- moduleIsPublic);
1626
+ emitAnyWholeModulePostTypeCheckSupplementaryOutputs (Instance, Invocation);
1638
1627
1639
1628
if (Action == FrontendOptions::ActionType::EmitSIB)
1640
1629
return serializeSIB (SM.get (), PSPs, Context, MSF);
0 commit comments