15#include "llvm/Support/MemoryBuffer.h"
16#include "llvm/Support/raw_ostream.h"
27class RawPCHContainerGenerator :
public ASTConsumer {
28 std::shared_ptr<PCHBuffer> Buffer;
29 std::unique_ptr<raw_pwrite_stream> OS;
32 RawPCHContainerGenerator(std::unique_ptr<llvm::raw_pwrite_stream> OS,
33 std::shared_ptr<PCHBuffer> Buffer)
34 : Buffer(
std::move(Buffer)), OS(
std::move(OS)) {}
36 ~RawPCHContainerGenerator()
override =
default;
38 void HandleTranslationUnit(
ASTContext &Ctx)
override {
39 if (Buffer->IsComplete) {
45 llvm::SmallVector<char, 0>
Empty;
46 Buffer->Data = std::move(
Empty);
52std::unique_ptr<ASTConsumer> RawPCHContainerWriter::CreatePCHContainerGenerator(
54 const std::string &OutputFileName, std::unique_ptr<llvm::raw_pwrite_stream> OS,
55 std::shared_ptr<PCHBuffer> Buffer)
const {
56 return std::make_unique<RawPCHContainerGenerator>(std::move(OS), Buffer);
60 static StringRef Raw(
"raw");
64std::unique_ptr<llvm::MemoryBuffer> RawPCHContainerReader::ExtractPCH(
65 std::unique_ptr<llvm::MemoryBuffer> Buffer)
const {
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 llvm::ArrayRef< llvm::StringRef > getFormats() const =0
Equivalent to the format passed to -fmodule-format=.
virtual ~PCHContainerReader()=0
virtual ~PCHContainerWriter()=0
Top level wrappers for InstallAPI frontend operations.