23 using namespace object;
28 "Ignore an empty index file and perform non-ThinLTO compilation"),
39 return std::move(Index);
45 if (Sec.isBitcode()) {
47 if (std::error_code EC = Sec.getContents(SecContents))
89 return IOrErr.takeError();
91 std::unique_ptr<ModuleSummaryIndex> Index = std::move(IOrErr.get());
92 return llvm::make_unique<ModuleSummaryIndexObjectFile>(Object,
102 std::error_code EC = FileOrErr.
getError();
static ErrorOr< MemoryBufferRef > findBitcodeInMemBuffer(MemoryBufferRef Object)
Finds and returns bitcode in the given memory buffer (which may be either a bitcode file or a native ...
static Expected< OwningBinary< ObjectFile > > createObjectFile(StringRef ObjectPath)
Create ObjectFile from path.
std::error_code getError() const
Represents either an error or a value T.
~ModuleSummaryIndexObjectFile() override
static Expected< std::unique_ptr< ModuleSummaryIndexObjectFile > > create(MemoryBufferRef Object)
Parse module summary index in the given memory buffer.
This class is the base class for all object file types.
ELF Relocatable object file.
Error takeError()
Take ownership of the stored error.
static ErrorOr< MemoryBufferRef > findBitcodeInObject(const ObjectFile &Obj)
Finds and returns bitcode embedded in the given object file, or an error code if not found...
Tagged union holding either a T or a Error.
initializer< Ty > init(const Ty &Val)
ModuleSummaryIndexObjectFile(MemoryBufferRef Object, std::unique_ptr< ModuleSummaryIndex > I)
The instances of the Type class are immutable: once they are created, they are never changed...
Error errorCodeToError(std::error_code EC)
Helper for converting an std::error_code to a Error.
static llvm::cl::opt< bool > IgnoreEmptyThinLTOIndexFile("ignore-empty-index-file", llvm::cl::ZeroOrMore, llvm::cl::desc("Ignore an empty index file and perform non-ThinLTO compilation"), llvm::cl::init(false))
section_iterator_range sections() const
StringRef getFileName() const
size_t getBufferSize() const
Expected< std::unique_ptr< ModuleSummaryIndex > > getModuleSummaryIndexForFile(StringRef Path)
Parse the module summary index out of an IR file and return the module summary index object if found...
file_magic identify_magic(StringRef magic)
Identify the type of a binary file based on how magical it is.
std::unique_ptr< ModuleSummaryIndex > takeIndex()
StringRef getBuffer() const
reference get()
Returns a reference to the stored T value.
static ErrorOr< std::unique_ptr< MemoryBuffer > > getFileOrSTDIN(const Twine &Filename, int64_t FileSize=-1, bool RequiresNullTerminator=true)
Open the specified file as a MemoryBuffer, or open stdin if the Filename is "-".
file_magic - An "enum class" enumeration of file types based on magic (the first N bytes of the file)...
This class is used to read just the module summary index related sections out of the given object (wh...
ModuleSummaryIndex.h This file contains the declarations the classes that hold the module index and s...
Expected< std::unique_ptr< ModuleSummaryIndex > > getModuleSummaryIndex(MemoryBufferRef Buffer)
Parse the specified bitcode buffer, returning the module summary index.
StringRef - Represent a constant reference to a string, i.e.
std::error_code errorToErrorCode(Error Err)
Helper for converting an ECError to a std::error_code.
This is a value type class that represents a single section in the list of sections in the object fil...