@@ -660,9 +660,8 @@ static void dumpAndPrintScopeMap(CompilerInvocation &Invocation,
660
660
scope.print (llvm::errs ());
661
661
}
662
662
663
- static SourceFile *
664
- getSourceFileOfCodeToBeGenerated (CompilerInvocation &Invocation,
665
- CompilerInstance &Instance) {
663
+ static SourceFile *getPrimaryOrMainSourceFile (CompilerInvocation &Invocation,
664
+ CompilerInstance &Instance) {
666
665
SourceFile *SF = Instance.getPrimarySourceFile ();
667
666
if (!SF) {
668
667
SourceFileKind Kind = Invocation.getSourceFileKind ();
@@ -686,36 +685,35 @@ static Optional<bool> dumpASTIfNeeded(CompilerInvocation &Invocation,
686
685
return None;
687
686
688
687
case FrontendOptions::ActionType::PrintAST:
689
- getSourceFileOfCodeToBeGenerated (Invocation, Instance)
688
+ getPrimaryOrMainSourceFile (Invocation, Instance)
690
689
->print (llvm::outs (), PrintOptions::printEverything ());
691
690
break ;
692
691
693
692
case FrontendOptions::ActionType::DumpScopeMaps:
694
- dumpAndPrintScopeMap (
695
- Invocation, Instance,
696
- getSourceFileOfCodeToBeGenerated (Invocation, Instance));
693
+ dumpAndPrintScopeMap (Invocation, Instance,
694
+ getPrimaryOrMainSourceFile (Invocation, Instance));
697
695
break ;
698
696
699
697
case FrontendOptions::ActionType::DumpTypeRefinementContexts:
700
- getSourceFileOfCodeToBeGenerated (Invocation, Instance)
698
+ getPrimaryOrMainSourceFile (Invocation, Instance)
701
699
->getTypeRefinementContext ()
702
700
->dump (llvm::errs (), Context.SourceMgr );
703
701
break ;
704
702
705
703
case FrontendOptions::ActionType::DumpInterfaceHash:
706
- getSourceFileOfCodeToBeGenerated (Invocation, Instance)
704
+ getPrimaryOrMainSourceFile (Invocation, Instance)
707
705
->dumpInterfaceHash (llvm::errs ());
708
706
break ;
709
707
710
708
case FrontendOptions::ActionType::EmitSyntax:
711
- emitSyntax (getSourceFileOfCodeToBeGenerated (Invocation, Instance),
709
+ emitSyntax (getPrimaryOrMainSourceFile (Invocation, Instance),
712
710
Invocation.getLangOptions (), Instance.getSourceMgr (),
713
711
opts.InputsAndOutputs .getSingleOutputFilename ());
714
712
break ;
715
713
716
714
case FrontendOptions::ActionType::DumpParse:
717
715
case FrontendOptions::ActionType::DumpAST:
718
- getSourceFileOfCodeToBeGenerated (Invocation, Instance)->dump ();
716
+ getPrimaryOrMainSourceFile (Invocation, Instance)->dump ();
719
717
break ;
720
718
721
719
case FrontendOptions::ActionType::EmitImportedModules:
@@ -1039,8 +1037,8 @@ static void setPrivateDiscriminatorIfNeeded(IRGenOptions &IRGenOpts,
1039
1037
IRGenOpts.DWARFDebugFlags += (" -private-discriminator " + PD.str ()).str ();
1040
1038
}
1041
1039
1042
- static bool serializeSIBIfNeeded (FrontendOptions &opts, SILModule *SM,
1043
- ASTContext &Context, ModuleOrSourceFile MSF) {
1040
+ static bool serializeSIB (FrontendOptions &opts, SILModule *SM,
1041
+ ASTContext &Context, ModuleOrSourceFile MSF) {
1044
1042
const std::string &moduleOutputPath = opts.ModuleOutputPath ;
1045
1043
assert (!moduleOutputPath.empty () && " must have an output path" );
1046
1044
@@ -1177,8 +1175,8 @@ static bool performCompileStepsPostSILGen(CompilerInstance &Instance,
1177
1175
1178
1176
if (Action == FrontendOptions::ActionType::EmitSIBGen) {
1179
1177
linkAllIfNeeded (Invocation, SM.get ());
1180
- serializeSIBIfNeeded (Invocation.getFrontendOptions (), SM.get (),
1181
- Instance.getASTContext (), MSF);
1178
+ serializeSIB (Invocation.getFrontendOptions (), SM.get (),
1179
+ Instance.getASTContext (), MSF);
1182
1180
return Context.hadError ();
1183
1181
}
1184
1182
@@ -1237,8 +1235,8 @@ static bool performCompileStepsPostSILGen(CompilerInstance &Instance,
1237
1235
opts.ImplicitObjCHeaderPath , moduleIsPublic);
1238
1236
1239
1237
if (Action == FrontendOptions::ActionType::EmitSIB)
1240
- return serializeSIBIfNeeded (Invocation.getFrontendOptions (), SM.get (),
1241
- Instance.getASTContext (), MSF);
1238
+ return serializeSIB (Invocation.getFrontendOptions (), SM.get (),
1239
+ Instance.getASTContext (), MSF);
1242
1240
1243
1241
const bool haveModulePath =
1244
1242
!opts.ModuleOutputPath .empty () || !opts.ModuleDocOutputPath .empty ();
0 commit comments