Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions clang/include/clang/Serialization/ASTRecordWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ class ASTRecordWriter

public:
/// Construct a ASTRecordWriter that uses the default encoding scheme.
ASTRecordWriter(ASTWriter &W, ASTWriter::RecordDataImpl &Record)
: DataStreamBasicWriter(W.getASTContext()), Writer(&W), Record(&Record) {}
ASTRecordWriter(ASTContext &Context, ASTWriter &W,
ASTWriter::RecordDataImpl &Record)
: DataStreamBasicWriter(Context), Writer(&W), Record(&Record) {}

/// Construct a ASTRecordWriter that uses the same encoding scheme as another
/// ASTRecordWriter.
Expand Down Expand Up @@ -208,7 +209,7 @@ class ASTRecordWriter

/// Emit a reference to a type.
void AddTypeRef(QualType T) {
return Writer->AddTypeRef(T, *Record);
return Writer->AddTypeRef(getASTContext(), T, *Record);
}
void writeQualType(QualType T) {
AddTypeRef(T);
Expand Down
28 changes: 11 additions & 17 deletions clang/include/clang/Serialization/ASTWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,6 @@ class ASTWriter : public ASTDeserializationListener,
/// The PCM manager which manages memory buffers for pcm files.
InMemoryModuleCache &ModuleCache;

/// The ASTContext we're writing.
ASTContext *Context = nullptr;

/// The preprocessor we're writing.
Preprocessor *PP = nullptr;

Expand Down Expand Up @@ -545,7 +542,7 @@ class ASTWriter : public ASTDeserializationListener,
unsigned getSubmoduleID(Module *Mod);

/// Write the given subexpression to the bitstream.
void WriteSubStmt(Stmt *S);
void WriteSubStmt(ASTContext &Context, Stmt *S);

void WriteBlockInfoBlock();
void WriteControlBlock(Preprocessor &PP, StringRef isysroot);
Expand All @@ -564,34 +561,36 @@ class ASTWriter : public ASTDeserializationListener,
void WriteHeaderSearch(const HeaderSearch &HS);
void WritePreprocessorDetail(PreprocessingRecord &PPRec,
uint64_t MacroOffsetsBase);
void WriteSubmodules(Module *WritingModule);
void WriteSubmodules(Module *WritingModule, ASTContext &Context);

void WritePragmaDiagnosticMappings(const DiagnosticsEngine &Diag,
bool isModule);

unsigned TypeExtQualAbbrev = 0;
void WriteTypeAbbrevs();
void WriteType(QualType T);
void WriteType(ASTContext &Context, QualType T);

bool isLookupResultExternal(StoredDeclsList &Result, DeclContext *DC);

void GenerateNameLookupTable(const DeclContext *DC,
void GenerateNameLookupTable(ASTContext &Context, const DeclContext *DC,
llvm::SmallVectorImpl<char> &LookupTable);
uint64_t WriteDeclContextLexicalBlock(ASTContext &Context,
const DeclContext *DC);
uint64_t WriteDeclContextVisibleBlock(ASTContext &Context, DeclContext *DC);
void WriteTypeDeclOffsets();
void WriteFileDeclIDsMap();
void WriteComments();
void WriteComments(ASTContext &Context);
void WriteSelectors(Sema &SemaRef);
void WriteReferencedSelectorsPool(Sema &SemaRef);
void WriteIdentifierTable(Preprocessor &PP, IdentifierResolver &IdResolver,
bool IsModule);
void WriteDeclAndTypes(ASTContext &Context);
void PrepareWritingSpecialDecls(Sema &SemaRef);
void WriteSpecialDeclRecords(Sema &SemaRef);
void WriteDeclUpdatesBlocks(RecordDataImpl &OffsetsRecord);
void WriteDeclContextVisibleUpdate(const DeclContext *DC);
void WriteDeclUpdatesBlocks(ASTContext &Context,
RecordDataImpl &OffsetsRecord);
void WriteDeclContextVisibleUpdate(ASTContext &Context,
const DeclContext *DC);
void WriteFPPragmaOptions(const FPOptionsOverride &Opts);
void WriteOpenCLExtensions(Sema &SemaRef);
void WriteCUDAPragmas(Sema &SemaRef);
Expand Down Expand Up @@ -653,11 +652,6 @@ class ASTWriter : public ASTDeserializationListener,
bool GeneratingReducedBMI = false);
~ASTWriter() override;

ASTContext &getASTContext() const {
assert(Context && "requested AST context when not writing AST");
return *Context;
}

const LangOptions &getLangOpts() const;

/// Get a timestamp for output into the AST file. The actual timestamp
Expand Down Expand Up @@ -723,10 +717,10 @@ class ASTWriter : public ASTDeserializationListener,
uint32_t getMacroDirectivesOffset(const IdentifierInfo *Name);

/// Emit a reference to a type.
void AddTypeRef(QualType T, RecordDataImpl &Record);
void AddTypeRef(ASTContext &Context, QualType T, RecordDataImpl &Record);

/// Force a type to be emitted and get its ID.
serialization::TypeID GetOrCreateTypeID(QualType T);
serialization::TypeID GetOrCreateTypeID(ASTContext &Context, QualType T);

/// Find the first local declaration of a given local redeclarable
/// decl.
Expand Down
Loading
Loading