@@ -537,8 +537,7 @@ class ASTWriter : public ASTDeserializationListener,
537537 void WriteSubStmt (ASTContext &Context, Stmt *S);
538538
539539 void WriteBlockInfoBlock ();
540- void WriteControlBlock (ASTContext &Context, Preprocessor &PP,
541- StringRef isysroot);
540+ void WriteControlBlock (Preprocessor &PP, StringRef isysroot);
542541
543542 // / Write out the signature and diagnostic options, and return the signature.
544543 void writeUnhashedControlBlock (Preprocessor &PP);
@@ -554,7 +553,7 @@ class ASTWriter : public ASTDeserializationListener,
554553 void WriteHeaderSearch (const HeaderSearch &HS);
555554 void WritePreprocessorDetail (PreprocessingRecord &PPRec,
556555 uint64_t MacroOffsetsBase);
557- void WriteSubmodules (Module *WritingModule, ASTContext & Context);
556+ void WriteSubmodules (Module *WritingModule, ASTContext * Context);
558557
559558 void WritePragmaDiagnosticMappings (const DiagnosticsEngine &Diag,
560559 bool isModule);
@@ -575,7 +574,7 @@ class ASTWriter : public ASTDeserializationListener,
575574 void WriteComments (ASTContext &Context);
576575 void WriteSelectors (Sema &SemaRef);
577576 void WriteReferencedSelectorsPool (Sema &SemaRef);
578- void WriteIdentifierTable (Preprocessor &PP, IdentifierResolver & IdResolver,
577+ void WriteIdentifierTable (Preprocessor &PP, IdentifierResolver * IdResolver,
579578 bool IsModule);
580579 void WriteDeclAndTypes (ASTContext &Context);
581580 void PrepareWritingSpecialDecls (Sema &SemaRef);
@@ -632,7 +631,7 @@ class ASTWriter : public ASTDeserializationListener,
632631 void WriteDeclAbbrevs ();
633632 void WriteDecl (ASTContext &Context, Decl *D);
634633
635- ASTFileSignature WriteASTCore (Sema &SemaRef , StringRef isysroot,
634+ ASTFileSignature WriteASTCore (Sema *SemaPtr , StringRef isysroot,
636635 Module *WritingModule);
637636
638637public:
@@ -652,10 +651,13 @@ class ASTWriter : public ASTDeserializationListener,
652651 // / include timestamps in the output file.
653652 time_t getTimestampForOutput (const FileEntry *E) const ;
654653
655- // / Write a precompiled header for the given semantic analysis.
654+ // / Write a precompiled header or a module with the AST produced by the
655+ // / \c Sema object, or a dependency scanner module with the preprocessor state
656+ // / produced by the \c Preprocessor object.
656657 // /
657- // / \param SemaRef a reference to the semantic analysis object that processed
658- // / the AST to be written into the precompiled header.
658+ // / \param Subject The \c Sema object that processed the AST to be written, or
659+ // / in the case of a dependency scanner module the \c Preprocessor that holds
660+ // / the state.
659661 // /
660662 // / \param WritingModule The module that we are writing. If null, we are
661663 // / writing a precompiled header.
@@ -666,8 +668,9 @@ class ASTWriter : public ASTDeserializationListener,
666668 // /
667669 // / \return the module signature, which eventually will be a hash of
668670 // / the module but currently is merely a random 32-bit number.
669- ASTFileSignature WriteAST (Sema &SemaRef, StringRef OutputFile,
670- Module *WritingModule, StringRef isysroot,
671+ ASTFileSignature WriteAST (llvm::PointerUnion<Sema *, Preprocessor *> Subject,
672+ StringRef OutputFile, Module *WritingModule,
673+ StringRef isysroot,
671674 bool ShouldCacheASTInMemory = false );
672675
673676 // / Emit a token.
0 commit comments