@@ -119,9 +119,6 @@ class ASTWriter : public ASTDeserializationListener,
119
119
// / The PCM manager which manages memory buffers for pcm files.
120
120
InMemoryModuleCache &ModuleCache;
121
121
122
- // / The ASTContext we're writing.
123
- ASTContext *Context = nullptr ;
124
-
125
122
// / The preprocessor we're writing.
126
123
Preprocessor *PP = nullptr ;
127
124
@@ -537,10 +534,11 @@ class ASTWriter : public ASTDeserializationListener,
537
534
unsigned getSubmoduleID (Module *Mod);
538
535
539
536
// / Write the given subexpression to the bitstream.
540
- void WriteSubStmt (Stmt *S);
537
+ void WriteSubStmt (ASTContext &Context, Stmt *S);
541
538
542
539
void WriteBlockInfoBlock ();
543
- void WriteControlBlock (Preprocessor &PP, StringRef isysroot);
540
+ void WriteControlBlock (ASTContext &Context, Preprocessor &PP,
541
+ StringRef isysroot);
544
542
545
543
// / Write out the signature and diagnostic options, and return the signature.
546
544
void writeUnhashedControlBlock (Preprocessor &PP);
@@ -556,34 +554,36 @@ class ASTWriter : public ASTDeserializationListener,
556
554
void WriteHeaderSearch (const HeaderSearch &HS);
557
555
void WritePreprocessorDetail (PreprocessingRecord &PPRec,
558
556
uint64_t MacroOffsetsBase);
559
- void WriteSubmodules (Module *WritingModule);
557
+ void WriteSubmodules (Module *WritingModule, ASTContext &Context );
560
558
561
559
void WritePragmaDiagnosticMappings (const DiagnosticsEngine &Diag,
562
560
bool isModule);
563
561
564
562
unsigned TypeExtQualAbbrev = 0 ;
565
563
void WriteTypeAbbrevs ();
566
- void WriteType (QualType T);
564
+ void WriteType (ASTContext &Context, QualType T);
567
565
568
566
bool isLookupResultExternal (StoredDeclsList &Result, DeclContext *DC);
569
567
570
- void GenerateNameLookupTable (const DeclContext *DC,
568
+ void GenerateNameLookupTable (ASTContext &Context, const DeclContext *DC,
571
569
llvm::SmallVectorImpl<char > &LookupTable);
572
570
uint64_t WriteDeclContextLexicalBlock (ASTContext &Context,
573
571
const DeclContext *DC);
574
572
uint64_t WriteDeclContextVisibleBlock (ASTContext &Context, DeclContext *DC);
575
573
void WriteTypeDeclOffsets ();
576
574
void WriteFileDeclIDsMap ();
577
- void WriteComments ();
575
+ void WriteComments (ASTContext &Context );
578
576
void WriteSelectors (Sema &SemaRef);
579
577
void WriteReferencedSelectorsPool (Sema &SemaRef);
580
578
void WriteIdentifierTable (Preprocessor &PP, IdentifierResolver &IdResolver,
581
579
bool IsModule);
582
580
void WriteDeclAndTypes (ASTContext &Context);
583
581
void PrepareWritingSpecialDecls (Sema &SemaRef);
584
582
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);
587
587
void WriteFPPragmaOptions (const FPOptionsOverride &Opts);
588
588
void WriteOpenCLExtensions (Sema &SemaRef);
589
589
void WriteCUDAPragmas (Sema &SemaRef);
@@ -645,11 +645,6 @@ class ASTWriter : public ASTDeserializationListener,
645
645
bool GeneratingReducedBMI = false );
646
646
~ASTWriter () override ;
647
647
648
- ASTContext &getASTContext () const {
649
- assert (Context && " requested AST context when not writing AST" );
650
- return *Context;
651
- }
652
-
653
648
const LangOptions &getLangOpts () const ;
654
649
655
650
// / Get a timestamp for output into the AST file. The actual timestamp
@@ -715,10 +710,10 @@ class ASTWriter : public ASTDeserializationListener,
715
710
uint32_t getMacroDirectivesOffset (const IdentifierInfo *Name);
716
711
717
712
// / Emit a reference to a type.
718
- void AddTypeRef (QualType T, RecordDataImpl &Record);
713
+ void AddTypeRef (ASTContext &Context, QualType T, RecordDataImpl &Record);
719
714
720
715
// / Force a type to be emitted and get its ID.
721
- serialization::TypeID GetOrCreateTypeID (QualType T);
716
+ serialization::TypeID GetOrCreateTypeID (ASTContext &Context, QualType T);
722
717
723
718
// / Find the first local declaration of a given local redeclarable
724
719
// / decl.
0 commit comments