16 #include "llvm/Bitstream/BitstreamReader.h" 17 #include "llvm/Support/raw_ostream.h" 20 using namespace clang;
28 class RawPCHContainerGenerator :
public ASTConsumer {
29 std::shared_ptr<PCHBuffer> Buffer;
30 std::unique_ptr<raw_pwrite_stream> OS;
33 RawPCHContainerGenerator(std::unique_ptr<llvm::raw_pwrite_stream> OS,
34 std::shared_ptr<PCHBuffer> Buffer)
35 : Buffer(std::move(Buffer)), OS(std::move(OS)) {}
37 ~RawPCHContainerGenerator()
override =
default;
39 void HandleTranslationUnit(
ASTContext &Ctx)
override {
40 if (Buffer->IsComplete) {
47 Buffer->Data = std::move(Empty);
53 std::unique_ptr<ASTConsumer> RawPCHContainerWriter::CreatePCHContainerGenerator(
55 const std::string &OutputFileName, std::unique_ptr<llvm::raw_pwrite_stream> OS,
56 std::shared_ptr<PCHBuffer> Buffer)
const {
57 return std::make_unique<RawPCHContainerGenerator>(std::move(OS), Buffer);
61 RawPCHContainerReader::ExtractPCH(llvm::MemoryBufferRef Buffer)
const {
62 return Buffer.getBuffer();
66 registerWriter(std::make_unique<RawPCHContainerWriter>());
67 registerReader(std::make_unique<RawPCHContainerReader>());
ASTConsumer - This is an abstract interface that should be implemented by clients that read ASTs...
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
CompilerInstance - Helper class for managing a single instance of the Clang compiler.
virtual ~PCHContainerReader()=0
Dataflow Directional Tag Classes.
PCHContainerOperations()
Automatically registers a RawPCHContainerWriter and RawPCHContainerReader.
virtual ~PCHContainerWriter()=0