@@ -119,9 +119,6 @@ class ASTWriter : public ASTDeserializationListener,
119119 // / The PCM manager which manages memory buffers for pcm files.
120120 InMemoryModuleCache &ModuleCache;
121121
122- // / The ASTContext we're writing.
123- ASTContext *Context = nullptr ;
124-
125122 // / The preprocessor we're writing.
126123 Preprocessor *PP = nullptr ;
127124
@@ -537,10 +534,11 @@ class ASTWriter : public ASTDeserializationListener,
537534 unsigned getSubmoduleID (Module *Mod);
538535
539536 // / Write the given subexpression to the bitstream.
540- void WriteSubStmt (Stmt *S);
537+ void WriteSubStmt (ASTContext &Context, Stmt *S);
541538
542539 void WriteBlockInfoBlock ();
543- void WriteControlBlock (Preprocessor &PP, StringRef isysroot);
540+ void WriteControlBlock (ASTContext &Context, Preprocessor &PP,
541+ StringRef isysroot);
544542
545543 // / Write out the signature and diagnostic options, and return the signature.
546544 void writeUnhashedControlBlock (Preprocessor &PP);
@@ -556,34 +554,36 @@ class ASTWriter : public ASTDeserializationListener,
556554 void WriteHeaderSearch (const HeaderSearch &HS);
557555 void WritePreprocessorDetail (PreprocessingRecord &PPRec,
558556 uint64_t MacroOffsetsBase);
559- void WriteSubmodules (Module *WritingModule);
557+ void WriteSubmodules (Module *WritingModule, ASTContext &Context );
560558
561559 void WritePragmaDiagnosticMappings (const DiagnosticsEngine &Diag,
562560 bool isModule);
563561
564562 unsigned TypeExtQualAbbrev = 0 ;
565563 void WriteTypeAbbrevs ();
566- void WriteType (QualType T);
564+ void WriteType (ASTContext &Context, QualType T);
567565
568566 bool isLookupResultExternal (StoredDeclsList &Result, DeclContext *DC);
569567
570- void GenerateNameLookupTable (const DeclContext *DC,
568+ void GenerateNameLookupTable (ASTContext &Context, const DeclContext *DC,
571569 llvm::SmallVectorImpl<char > &LookupTable);
572570 uint64_t WriteDeclContextLexicalBlock (ASTContext &Context,
573571 const DeclContext *DC);
574572 uint64_t WriteDeclContextVisibleBlock (ASTContext &Context, DeclContext *DC);
575573 void WriteTypeDeclOffsets ();
576574 void WriteFileDeclIDsMap ();
577- void WriteComments ();
575+ void WriteComments (ASTContext &Context );
578576 void WriteSelectors (Sema &SemaRef);
579577 void WriteReferencedSelectorsPool (Sema &SemaRef);
580578 void WriteIdentifierTable (Preprocessor &PP, IdentifierResolver &IdResolver,
581579 bool IsModule);
582580 void WriteDeclAndTypes (ASTContext &Context);
583581 void PrepareWritingSpecialDecls (Sema &SemaRef);
584582 void WriteSpecialDeclRecords (Sema &SemaRef);
585- void WriteDeclUpdatesBlocks (RecordDataImpl &OffsetsRecord);
586- void WriteDeclContextVisibleUpdate (const DeclContext *DC);
583+ void WriteDeclUpdatesBlocks (ASTContext &Context,
584+ RecordDataImpl &OffsetsRecord);
585+ void WriteDeclContextVisibleUpdate (ASTContext &Context,
586+ const DeclContext *DC);
587587 void WriteFPPragmaOptions (const FPOptionsOverride &Opts);
588588 void WriteOpenCLExtensions (Sema &SemaRef);
589589 void WriteCUDAPragmas (Sema &SemaRef);
@@ -645,11 +645,6 @@ class ASTWriter : public ASTDeserializationListener,
645645 bool GeneratingReducedBMI = false );
646646 ~ASTWriter () override ;
647647
648- ASTContext &getASTContext () const {
649- assert (Context && " requested AST context when not writing AST" );
650- return *Context;
651- }
652-
653648 const LangOptions &getLangOpts () const ;
654649
655650 // / Get a timestamp for output into the AST file. The actual timestamp
@@ -715,10 +710,10 @@ class ASTWriter : public ASTDeserializationListener,
715710 uint32_t getMacroDirectivesOffset (const IdentifierInfo *Name);
716711
717712 // / Emit a reference to a type.
718- void AddTypeRef (QualType T, RecordDataImpl &Record);
713+ void AddTypeRef (ASTContext &Context, QualType T, RecordDataImpl &Record);
719714
720715 // / Force a type to be emitted and get its ID.
721- serialization::TypeID GetOrCreateTypeID (QualType T);
716+ serialization::TypeID GetOrCreateTypeID (ASTContext &Context, QualType T);
722717
723718 // / Find the first local declaration of a given local redeclarable
724719 // / decl.
0 commit comments