16 #include "llvm/Bitcode/BitstreamReader.h"
17 #include "llvm/Support/raw_ostream.h"
19 using namespace clang;
24 class RawPCHContainerGenerator :
public ASTConsumer {
25 std::shared_ptr<PCHBuffer> Buffer;
26 raw_pwrite_stream *OS;
33 const std::string &MainFileName,
34 const std::string &OutputFileName,
35 llvm::raw_pwrite_stream *OS,
36 std::shared_ptr<PCHBuffer> Buffer)
37 : Buffer(Buffer), OS(OS) {}
39 virtual ~RawPCHContainerGenerator() {}
41 void HandleTranslationUnit(
ASTContext &Ctx)
override {
42 if (Buffer->IsComplete) {
49 Buffer->Data = std::move(Empty);
54 std::unique_ptr<ASTConsumer> RawPCHContainerWriter::CreatePCHContainerGenerator(
57 const LangOptions &LO,
const std::string &MainFileName,
58 const std::string &OutputFileName, llvm::raw_pwrite_stream *OS,
59 std::shared_ptr<PCHBuffer> Buffer)
const {
60 return llvm::make_unique<RawPCHContainerGenerator>(
61 Diags, HSO, PPO, TO, LO, MainFileName, OutputFileName, OS, Buffer);
64 void RawPCHContainerReader::ExtractPCH(
65 llvm::MemoryBufferRef Buffer, llvm::BitstreamReader &StreamFile)
const {
66 StreamFile.init((
const unsigned char *)Buffer.getBufferStart(),
67 (
const unsigned char *)Buffer.getBufferEnd());
Options for controlling the target.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Concrete class used by the front-end to report problems and issues.
void registerReader(std::unique_ptr< PCHContainerReader > Reader)
void registerWriter(std::unique_ptr< PCHContainerWriter > Writer)