9 #ifndef LLVM_CLANG_SERIALIZATION_PCHCONTAINEROPERATIONS_H 10 #define LLVM_CLANG_SERIALIZATION_PCHCONTAINEROPERATIONS_H 13 #include "llvm/ADT/SmallVector.h" 14 #include "llvm/ADT/StringMap.h" 15 #include "llvm/Support/MemoryBuffer.h" 19 class raw_pwrite_stream;
26 class DiagnosticsEngine;
27 class CompilerInstance;
41 virtual llvm::StringRef getFormat()
const = 0;
46 virtual std::unique_ptr<ASTConsumer>
48 const std::string &MainFileName,
49 const std::string &OutputFileName,
50 std::unique_ptr<llvm::raw_pwrite_stream> OS,
51 std::shared_ptr<PCHBuffer> Buffer)
const = 0;
61 virtual llvm::StringRef getFormat()
const = 0;
64 virtual llvm::StringRef ExtractPCH(llvm::MemoryBufferRef Buffer)
const = 0;
69 llvm::StringRef getFormat()
const override {
return "raw"; }
73 std::unique_ptr<ASTConsumer>
75 const std::string &MainFileName,
76 const std::string &OutputFileName,
77 std::unique_ptr<llvm::raw_pwrite_stream> OS,
78 std::shared_ptr<PCHBuffer> Buffer)
const override;
83 llvm::StringRef getFormat()
const override {
return "raw"; }
86 llvm::StringRef ExtractPCH(llvm::MemoryBufferRef Buffer)
const override;
91 llvm::StringMap<std::unique_ptr<PCHContainerWriter>> Writers;
92 llvm::StringMap<std::unique_ptr<PCHContainerReader>> Readers;
98 Writers[Writer->getFormat()] = std::move(Writer);
101 Readers[Reader->getFormat()] = std::move(Reader);
104 return Writers[Format].get();
107 return Readers[Format].get();
110 return *getReaderOrNull(
"raw");
Specialize PointerLikeTypeTraits to allow LazyGenerationalUpdatePtr to be placed into a PointerUnion...
const PCHContainerReader * getReaderOrNull(llvm::StringRef Format)
Defines the clang::Module class, which describes a module in the source code.
A registry of PCHContainerWriter and -Reader objects for different formats.
The signature of a module, which is a hash of the AST content.
This abstract interface provides operations for creating containers for serialized ASTs (precompiled ...
This abstract interface provides operations for unwrapping containers for serialized ASTs (precompile...
void registerReader(std::unique_ptr< PCHContainerReader > Reader)
const PCHContainerReader & getRawReader()
ASTFileSignature Signature
CompilerInstance - Helper class for managing a single instance of the Clang compiler.
const PCHContainerWriter * getWriterOrNull(llvm::StringRef Format)
Dataflow Directional Tag Classes.
Implements read operations for a raw pass-through PCH container.
llvm::SmallVector< char, 0 > Data
void registerWriter(std::unique_ptr< PCHContainerWriter > Writer)
Implements write operations for a raw pass-through PCH container.