16#include "llvm/Bitstream/BitstreamReader.h"
17#include "llvm/Support/raw_ostream.h"
28class 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);
53std::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 static StringRef Raw(
"raw");
66RawPCHContainerReader::ExtractPCH(llvm::MemoryBufferRef Buffer)
const {
67 return Buffer.getBuffer();
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.
void registerReader(std::unique_ptr< PCHContainerReader > Reader)
PCHContainerOperations()
Automatically registers a RawPCHContainerWriter and RawPCHContainerReader.
void registerWriter(std::unique_ptr< PCHContainerWriter > Writer)
virtual ~PCHContainerReader()=0
virtual ~PCHContainerWriter()=0