@@ -517,24 +517,25 @@ namespace {
517517class ASTInfoCollector : public ASTReaderListener {
518518 Preprocessor &PP;
519519 ASTContext *Context;
520+ FileSystemOptions &FSOpts;
520521 HeaderSearchOptions &HSOpts;
521522 PreprocessorOptions &PPOpts;
522523 LangOptions &LangOpt;
523524 std::shared_ptr<TargetOptions> &TargetOpts;
524525 IntrusiveRefCntPtr<TargetInfo> &Target;
525526 unsigned &Counter;
526527 bool InitializedLanguage = false ;
527- bool InitializedHeaderSearchPaths = false ;
528+ bool InitializedFileSystem = false ;
528529
529530public:
530531 ASTInfoCollector (Preprocessor &PP, ASTContext *Context,
531- HeaderSearchOptions &HSOpts, PreprocessorOptions &PPOpts ,
532- LangOptions &LangOpt,
532+ FileSystemOptions &FSOpts, HeaderSearchOptions &HSOpts ,
533+ PreprocessorOptions &PPOpts, LangOptions &LangOpt,
533534 std::shared_ptr<TargetOptions> &TargetOpts,
534535 IntrusiveRefCntPtr<TargetInfo> &Target, unsigned &Counter)
535- : PP(PP), Context(Context), HSOpts(HSOpts ), PPOpts(PPOpts ),
536- LangOpt (LangOpt ), TargetOpts(TargetOpts ), Target(Target ),
537- Counter(Counter) {}
536+ : PP(PP), Context(Context), FSOpts(FSOpts ), HSOpts(HSOpts ),
537+ PPOpts (PPOpts ), LangOpt(LangOpt ), TargetOpts(TargetOpts ),
538+ Target(Target), Counter(Counter) {}
538539
539540 bool ReadLanguageOptions (const LangOptions &LangOpts,
540541 StringRef ModuleFilename, bool Complain,
@@ -568,7 +569,6 @@ class ASTInfoCollector : public ASTReaderListener {
568569 this ->HSOpts .ForceCheckCXX20ModulesInputFiles ;
569570 llvm::SaveAndRestore X (this ->HSOpts .UserEntries );
570571 llvm::SaveAndRestore Y (this ->HSOpts .SystemHeaderPrefixes );
571- llvm::SaveAndRestore Z (this ->HSOpts .VFSOverlayFiles );
572572
573573 this ->HSOpts = HSOpts;
574574 this ->HSOpts .ForceCheckCXX20ModulesInputFiles =
@@ -577,24 +577,29 @@ class ASTInfoCollector : public ASTReaderListener {
577577 return false ;
578578 }
579579
580- bool ReadHeaderSearchPaths (const HeaderSearchOptions &HSOpts ,
580+ bool ReadFileSystemOptions (const FileSystemOptions &FSOpts ,
581581 bool Complain) override {
582- if (InitializedHeaderSearchPaths )
582+ if (InitializedFileSystem )
583583 return false ;
584584
585- this ->HSOpts .UserEntries = HSOpts.UserEntries ;
586- this ->HSOpts .SystemHeaderPrefixes = HSOpts.SystemHeaderPrefixes ;
587- this ->HSOpts .VFSOverlayFiles = HSOpts.VFSOverlayFiles ;
585+ this ->FSOpts .VFSOverlayFiles = FSOpts.VFSOverlayFiles ;
588586
589587 // Initialize the FileManager. We can't do this in update(), since that
590588 // performs the initialization too late (once both target and language
591589 // options are read).
592590 PP.getFileManager ().setVirtualFileSystem (createVFSFromOverlayFiles (
593- HSOpts .VFSOverlayFiles , PP.getDiagnostics (),
591+ FSOpts .VFSOverlayFiles , PP.getDiagnostics (),
594592 PP.getFileManager ().getVirtualFileSystemPtr ()));
595593
596- InitializedHeaderSearchPaths = true ;
594+ InitializedFileSystem = true ;
595+
596+ return false ;
597+ }
597598
599+ bool ReadHeaderSearchPaths (const HeaderSearchOptions &HSOpts,
600+ bool Complain) override {
601+ this ->HSOpts .UserEntries = HSOpts.UserEntries ;
602+ this ->HSOpts .SystemHeaderPrefixes = HSOpts.SystemHeaderPrefixes ;
598603 return false ;
599604 }
600605
@@ -867,8 +872,8 @@ std::unique_ptr<ASTUnit> ASTUnit::LoadFromASTFile(
867872
868873 unsigned Counter = 0 ;
869874 AST->Reader ->setListener (std::make_unique<ASTInfoCollector>(
870- *AST->PP , AST->Ctx .get (), * AST->HSOpts , *AST->PPOpts , *AST->LangOpts ,
871- AST->TargetOpts , AST->Target , Counter));
875+ *AST->PP , AST->Ctx .get (), AST->FileSystemOpts , *AST->HSOpts , *AST->PPOpts ,
876+ *AST-> LangOpts , AST->TargetOpts , AST->Target , Counter));
872877
873878 // Attach the AST reader to the AST context as an external AST
874879 // source, so that declarations will be deserialized from the
0 commit comments