Module file extensions are likely to need access to
Sema/Preprocessor/ASTContext, and cannot get it through other
sources.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@255065
91177308-0d34-0410-b5e6-
96231b3b80d8
void WriteObjCCategories();
void WriteLateParsedTemplates(Sema &SemaRef);
void WriteOptimizePragmaOptions(Sema &SemaRef);
- void WriteModuleFileExtension(ModuleFileExtensionWriter &Writer);
+ void WriteModuleFileExtension(Sema &SemaRef,
+ ModuleFileExtensionWriter &Writer);
unsigned DeclParmVarAbbrev;
unsigned DeclContextLexicalAbbrev;
class ASTReader;
class ASTWriter;
-
+class Sema;
+
namespace serialization {
class ModuleFile;
} // end namespace serialization
/// The default implementation of this function simply returns the
/// hash code as given, so the presence/absence of this extension
/// does not distinguish module files.
- virtual llvm::hash_code hashExtension(llvm::hash_code Code) const;
+ virtual llvm::hash_code hashExtension(llvm::hash_code c) const;
/// Create a new module file extension writer, which will be
/// responsible for writing the extension contents into a particular
/// Responsible for writing the contents of the extension into the
/// given stream. All of the contents should be written into custom
/// records with IDs >= FIRST_EXTENSION_RECORD_ID.
- virtual void writeExtensionContents(llvm::BitstreamWriter &Stream) = 0;
+ virtual void writeExtensionContents(Sema &SemaRef,
+ llvm::BitstreamWriter &Stream) = 0;
};
/// Abstract base class that reads a module file extension block from
TestModuleFileExtension::Writer::~Writer() { }
void TestModuleFileExtension::Writer::writeExtensionContents(
+ Sema &SemaRef,
llvm::BitstreamWriter &Stream) {
using namespace llvm;
Writer(ModuleFileExtension *Ext) : ModuleFileExtensionWriter(Ext) { }
~Writer() override;
- void writeExtensionContents(llvm::BitstreamWriter &Stream) override;
+ void writeExtensionContents(Sema &SemaRef,
+ llvm::BitstreamWriter &Stream) override;
};
class Reader : public ModuleFileExtensionReader {
Stream.EmitRecord(OPTIMIZE_PRAGMA_OPTIONS, Record);
}
-void ASTWriter::WriteModuleFileExtension(ModuleFileExtensionWriter &Writer) {
+void ASTWriter::WriteModuleFileExtension(Sema &SemaRef,
+ ModuleFileExtensionWriter &Writer) {
// Enter the extension block.
Stream.EnterSubblock(EXTENSION_BLOCK_ID, 4);
Stream.EmitRecordWithBlob(Abbrev, Record, Buffer);
// Emit the contents of the extension block.
- Writer.writeExtensionContents(Stream);
+ Writer.writeExtensionContents(SemaRef, Stream);
// Exit the extension block.
Stream.ExitBlock();
// Write the module file extension blocks.
for (const auto &ExtWriter : ModuleFileExtensionWriters)
- WriteModuleFileExtension(*ExtWriter);
+ WriteModuleFileExtension(SemaRef, *ExtWriter);
return Signature;
}