1//===-- CodeGen/ObjectFilePCHContainerOperations.h - ------------*- C++ -*-===// 2// 3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4// See https://llvm.org/LICENSE.txt for license information. 5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6// 7//===----------------------------------------------------------------------===// 8 9#ifndef LLVM_CLANG_CODEGEN_OBJECT_FILE_PCH_CONTAINER_OPERATIONS_H 10#define LLVM_CLANG_CODEGEN_OBJECT_FILE_PCH_CONTAINER_OPERATIONS_H 11 12#include "clang/Frontend/PCHContainerOperations.h" 13 14namespace clang { 15 16/// A PCHContainerWriter implementation that uses LLVM to 17/// wraps Clang modules inside a COFF, ELF, or Mach-O container. 18class ObjectFilePCHContainerWriter : public PCHContainerWriter { 19 StringRef getFormat() const override { return "obj"; } 20 21 /// Return an ASTConsumer that can be chained with a 22 /// PCHGenerator that produces a wrapper file format 23 /// that also contains full debug info for the module. 24 std::unique_ptr<ASTConsumer> 25 CreatePCHContainerGenerator(CompilerInstance &CI, 26 const std::string &MainFileName, 27 const std::string &OutputFileName, 28 std::unique_ptr<llvm::raw_pwrite_stream> OS, 29 std::shared_ptr<PCHBuffer> Buffer) const override; 30}; 31 32/// A PCHContainerReader implementation that uses LLVM to 33/// wraps Clang modules inside a COFF, ELF, or Mach-O container. 34class ObjectFilePCHContainerReader : public PCHContainerReader { 35 StringRef getFormat() const override { return "obj"; } 36 37 /// Returns the serialized AST inside the PCH container Buffer. 38 StringRef ExtractPCH(llvm::MemoryBufferRef Buffer) const override; 39}; 40} 41 42#endif 43