24
24
#include " swift/Basic/SourceManager.h"
25
25
#include " swift/Basic/Statistic.h"
26
26
#include " swift/Frontend/ParseableInterfaceModuleLoader.h"
27
- #include " swift/Parse/DelayedParsingCallbacks.h"
28
27
#include " swift/Parse/Lexer.h"
29
28
#include " swift/SIL/SILModule.h"
30
29
#include " swift/SILOptimizer/PassManager/Passes.h"
@@ -758,14 +757,6 @@ void CompilerInstance::createREPLFile(const ImplicitImports &implicitImports) {
758
757
addAdditionalInitialImportsTo (SingleInputFile, implicitImports);
759
758
}
760
759
761
- std::unique_ptr<DelayedParsingCallbacks>
762
- CompilerInstance::computeDelayedParsingCallback () {
763
- if (Invocation.isCodeCompletion ())
764
- return llvm::make_unique<CodeCompleteDelayedCallbacks>(
765
- SourceMgr.getCodeCompletionLoc ());
766
- return nullptr ;
767
- }
768
-
769
760
void CompilerInstance::addMainFileToModule (
770
761
const ImplicitImports &implicitImports) {
771
762
auto *MainFile = createSourceFileForMainModule (
@@ -776,13 +767,10 @@ void CompilerInstance::addMainFileToModule(
776
767
void CompilerInstance::parseAndCheckTypesUpTo (
777
768
const ImplicitImports &implicitImports, SourceFile::ASTStage_t limitStage) {
778
769
FrontendStatsTracer tracer (Context->Stats , " parse-and-check-types" );
779
- std::unique_ptr<DelayedParsingCallbacks> DelayedCB{
780
- computeDelayedParsingCallback ()};
781
770
782
771
PersistentState = llvm::make_unique<PersistentParserState>();
783
772
784
- bool hadLoadError = parsePartialModulesAndLibraryFiles (
785
- implicitImports, DelayedCB.get ());
773
+ bool hadLoadError = parsePartialModulesAndLibraryFiles (implicitImports);
786
774
if (Invocation.isCodeCompletion ()) {
787
775
// When we are doing code completion, make sure to emit at least one
788
776
// diagnostic, so that ASTContext is marked as erroneous. In this case
@@ -800,7 +788,7 @@ void CompilerInstance::parseAndCheckTypesUpTo(
800
788
// In addition, the main file has parsing and type-checking
801
789
// interwined.
802
790
if (MainBufferID != NO_SUCH_BUFFER) {
803
- parseAndTypeCheckMainFileUpTo (limitStage, DelayedCB. get (), TypeCheckOptions);
791
+ parseAndTypeCheckMainFileUpTo (limitStage, TypeCheckOptions);
804
792
}
805
793
806
794
assert (llvm::all_of (MainModule->getFiles (), [](const FileUnit *File) -> bool {
@@ -846,8 +834,7 @@ void CompilerInstance::parseAndCheckTypesUpTo(
846
834
}
847
835
848
836
void CompilerInstance::parseLibraryFile (
849
- unsigned BufferID, const ImplicitImports &implicitImports,
850
- DelayedParsingCallbacks *DelayedCB) {
837
+ unsigned BufferID, const ImplicitImports &implicitImports) {
851
838
FrontendStatsTracer tracer (Context->Stats , " parse-library-file" );
852
839
853
840
auto *NextInput = createSourceFileForMainModule (
@@ -865,7 +852,7 @@ void CompilerInstance::parseLibraryFile(
865
852
// Parser may stop at some erroneous constructions like #else, #endif
866
853
// or '}' in some cases, continue parsing until we are done
867
854
parseIntoSourceFile (*NextInput, BufferID, &Done, nullptr ,
868
- PersistentState.get (), DelayedCB,
855
+ PersistentState.get (),
869
856
/* DelayedBodyParsing=*/ !IsPrimary);
870
857
} while (!Done);
871
858
@@ -893,8 +880,7 @@ OptionSet<TypeCheckingFlags> CompilerInstance::computeTypeCheckingOptions() {
893
880
}
894
881
895
882
bool CompilerInstance::parsePartialModulesAndLibraryFiles (
896
- const ImplicitImports &implicitImports,
897
- DelayedParsingCallbacks *DelayedCB) {
883
+ const ImplicitImports &implicitImports) {
898
884
FrontendStatsTracer tracer (Context->Stats ,
899
885
" parse-partial-modules-and-library-files" );
900
886
bool hadLoadError = false ;
@@ -910,15 +896,14 @@ bool CompilerInstance::parsePartialModulesAndLibraryFiles(
910
896
// Then parse all the library files.
911
897
for (auto BufferID : InputSourceCodeBufferIDs) {
912
898
if (BufferID != MainBufferID) {
913
- parseLibraryFile (BufferID, implicitImports, DelayedCB );
899
+ parseLibraryFile (BufferID, implicitImports);
914
900
}
915
901
}
916
902
return hadLoadError;
917
903
}
918
904
919
905
void CompilerInstance::parseAndTypeCheckMainFileUpTo (
920
906
SourceFile::ASTStage_t LimitStage,
921
- DelayedParsingCallbacks *DelayedParseCB,
922
907
OptionSet<TypeCheckingFlags> TypeCheckOptions) {
923
908
FrontendStatsTracer tracer (Context->Stats ,
924
909
" parse-and-typecheck-main-file" );
@@ -942,7 +927,7 @@ void CompilerInstance::parseAndTypeCheckMainFileUpTo(
942
927
// with 'sil' definitions.
943
928
parseIntoSourceFile (MainFile, MainFile.getBufferID ().getValue (), &Done,
944
929
TheSILModule ? &SILContext : nullptr ,
945
- PersistentState.get (), DelayedParseCB,
930
+ PersistentState.get (),
946
931
/* DelayedBodyParsing=*/ false );
947
932
948
933
if (mainIsPrimary && (Done || CurTUElem < MainFile.Decls .size ())) {
@@ -1069,7 +1054,7 @@ void CompilerInstance::performParseOnly(bool EvaluateConditionals,
1069
1054
BufferID);
1070
1055
1071
1056
parseIntoSourceFileFull (*NextInput, BufferID, PersistentState.get (),
1072
- nullptr , /* DelayBodyParsing=*/ !IsPrimary);
1057
+ /* DelayBodyParsing=*/ !IsPrimary);
1073
1058
}
1074
1059
1075
1060
// Now parse the main file.
@@ -1079,7 +1064,7 @@ void CompilerInstance::performParseOnly(bool EvaluateConditionals,
1079
1064
MainFile.SyntaxParsingCache = Invocation.getMainFileSyntaxParsingCache ();
1080
1065
1081
1066
parseIntoSourceFileFull (MainFile, MainFile.getBufferID ().getValue (),
1082
- PersistentState.get (), nullptr ,
1067
+ PersistentState.get (),
1083
1068
/* DelayBodyParsing=*/ false );
1084
1069
}
1085
1070
0 commit comments