23 #include <system_error> 41 std::unique_ptr<Module>
45 std::unique_ptr<Module> M =
55 std::unique_ptr<Module>
61 if (std::error_code EC = FileOrErr.
getError()) {
63 "Could not open input file: " + EC.message());
74 std::unique_ptr<Module> M =
76 std::unique_ptr<ModuleSummaryIndex>
Index =
77 make_unique<ModuleSummaryIndex>(
true);
81 return {
nullptr,
nullptr};
83 return {std::move(M), std::move(Index)};
91 if (std::error_code EC = FileOrErr.
getError()) {
93 "Could not open input file: " + EC.message());
94 return {
nullptr,
nullptr};
102 std::unique_ptr<Module>
107 return parseAssembly(F, Err, Context, Slots, UpgradeDebugInfo,
124 std::unique_ptr<ModuleSummaryIndex>
126 std::unique_ptr<ModuleSummaryIndex>
Index =
127 make_unique<ModuleSummaryIndex>(
false);
135 std::unique_ptr<ModuleSummaryIndex>
139 if (std::error_code EC = FileOrErr.
getError()) {
141 "Could not open input file: " + EC.message());
155 .parseStandaloneConstantValue(C, Slots))
166 if (Read != Asm.
size()) {
Represents either an error or a value T.
This class represents lattice values for constants.
Constant * parseConstantValue(StringRef Asm, SMDiagnostic &Err, const Module &M, const SlotMapping *Slots=nullptr)
Parse a type and a constant value in the given string.
A Module instance is used to store all the information related to an LLVM module. ...
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
static std::unique_ptr< MemoryBuffer > getMemBuffer(StringRef InputData, StringRef BufferName="", bool RequiresNullTerminator=true)
Open the specified memory range as a MemoryBuffer.
std::unique_ptr< Module > parseAssemblyString(StringRef AsmString, SMDiagnostic &Err, LLVMContext &Context, SlotMapping *Slots=nullptr, bool UpgradeDebugInfo=true, StringRef DataLayoutString="")
The function is a secondary interface to the LLVM Assembly Parser.
LLVMContext & getContext() const
Get the global data context.
StringRef getBuffer() const
std::unique_ptr< ModuleSummaryIndex > parseSummaryIndexAssemblyFile(StringRef Filename, SMDiagnostic &Err)
This function is a main interface to the LLVM Assembly Parser.
unsigned AddNewSourceBuffer(std::unique_ptr< MemoryBuffer > F, SMLoc IncludeLoc)
Add a new source buffer to this source manager.
Type * parseTypeAtBeginning(StringRef Asm, unsigned &Read, SMDiagnostic &Err, const Module &M, const SlotMapping *Slots=nullptr)
Parse a string Asm that starts with a type.
Class to hold module path string table and global value map, and encapsulate methods for operating on...
std::unique_ptr< ModuleSummaryIndex > parseSummaryIndexAssembly(MemoryBufferRef F, SMDiagnostic &Err)
Parse LLVM Assembly for summary index from a MemoryBuffer.
std::unique_ptr< Module > parseAssembly(MemoryBufferRef F, SMDiagnostic &Err, LLVMContext &Context, SlotMapping *Slots=nullptr, bool UpgradeDebugInfo=true, StringRef DataLayoutString="")
parseAssemblyFile and parseAssemblyString are wrappers around this function.
bool parseAssemblyInto(MemoryBufferRef F, Module *M, ModuleSummaryIndex *Index, SMDiagnostic &Err, SlotMapping *Slots=nullptr, bool UpgradeDebugInfo=true, StringRef DataLayoutString="")
This function is the low-level interface to the LLVM Assembly Parser.
The instances of the Type class are immutable: once they are created, they are never changed...
This is an important class for using LLVM in a threaded context.
std::unique_ptr< Module > parseAssemblyFile(StringRef Filename, SMDiagnostic &Err, LLVMContext &Context, SlotMapping *Slots=nullptr, bool UpgradeDebugInfo=true, StringRef DataLayoutString="")
This function is a main interface to the LLVM Assembly Parser.
This is an important base class in LLVM.
std::error_code getError() const
bool UpgradeDebugInfo(Module &M)
Check the debug info version number, if it is out-dated, drop the debug info.
This owns the files read by a parser, handles include stacks, and handles diagnostic wrangling...
SMDiagnostic GetMessage(SMLoc Loc, DiagKind Kind, const Twine &Msg, ArrayRef< SMRange > Ranges=None, ArrayRef< SMFixIt > FixIts=None) const
Return an SMDiagnostic at the specified location with the specified string.
ParsedModuleAndIndex parseAssemblyWithIndex(MemoryBufferRef F, SMDiagnostic &Err, LLVMContext &Context, SlotMapping *Slots=nullptr, bool UpgradeDebugInfo=true, StringRef DataLayoutString="")
Parse LLVM Assembly including the summary index from a MemoryBuffer.
ParsedModuleAndIndex parseAssemblyFileWithIndex(StringRef Filename, SMDiagnostic &Err, LLVMContext &Context, SlotMapping *Slots=nullptr, bool UpgradeDebugInfo=true, StringRef DataLayoutString="")
This function is a main interface to the LLVM Assembly Parser.
Module.h This file contains the declarations for the Module class.
StringRef getBufferIdentifier() const
This struct contains the mappings from the slot numbers to unnamed metadata nodes, global values and types.
static SMLoc getFromPointer(const char *Ptr)
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 "-".
static bool parseSummaryIndexAssemblyInto(MemoryBufferRef F, ModuleSummaryIndex &Index, SMDiagnostic &Err)
Holds the Module and ModuleSummaryIndex returned by the interfaces that parse both.
ModuleSummaryIndex.h This file contains the declarations the classes that hold the module index and s...
StringRef - Represent a constant reference to a string, i.e.
Type * parseType(StringRef Asm, SMDiagnostic &Err, const Module &M, const SlotMapping *Slots=nullptr)
Parse a type in the given string.
Represents a location in source code.
Instances of this class encapsulate one diagnostic report, allowing printing to a raw_ostream as a ca...