LLVM: lib/Bitcode/Reader/BitReader.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
15#include
16#include
17
18using namespace llvm;
19
20
21
22
24 char **OutMessage) {
26 OutMessage);
27}
28
34
38 char **OutMessage) {
41
44 std::string Message;
47 });
48 if (OutMessage)
49 *OutMessage = strdup(Message.c_str());
51 return 1;
52 }
53
54 *OutModule = wrap(ModuleOrErr.get().release());
55 return 0;
56}
57
63
68 return 1;
69 }
70
71 *OutModule = wrap(ModuleOrErr.get().release());
72 return 0;
73}
74
75
76
77
82 std::unique_ptr Owner(unwrap(MemBuf));
85
86
87 (void)Owner.release();
88
90 std::string Message;
93 });
94 if (OutMessage)
95 *OutMessage = strdup(Message.c_str());
97 return 1;
98 }
99
100 *OutM = wrap(ModuleOrErr.get().release());
101
102 return 0;
103}
104
109 std::unique_ptr Owner(unwrap(MemBuf));
110
114
115 if (ModuleOrErr.getError()) {
117 return 1;
118 }
119
120 *OutM = wrap(ModuleOrErr.get().release());
121 return 0;
122}
123
125 char **OutMessage) {
127 OutMessage);
128}
129
LLVMBool LLVMParseBitcode2(LLVMMemoryBufferRef MemBuf, LLVMModuleRef *OutModule)
Definition BitReader.cpp:29
LLVMBool LLVMParseBitcode(LLVMMemoryBufferRef MemBuf, LLVMModuleRef *OutModule, char **OutMessage)
Definition BitReader.cpp:23
LLVMBool LLVMGetBitcodeModule2(LLVMMemoryBufferRef MemBuf, LLVMModuleRef *OutM)
Definition BitReader.cpp:130
LLVMBool LLVMGetBitcodeModule(LLVMMemoryBufferRef MemBuf, LLVMModuleRef *OutM, char **OutMessage)
Definition BitReader.cpp:124
static ManagedStatic< DebugCounterOwner > Owner
Module.h This file contains the declarations for the Module class.
Base class for error info classes.
virtual std::string message() const
Return the error message as a string.
Represents either an error or a value T.
std::error_code getError() const
Lightweight error class with error context and mandatory checking.
Tagged union holding either a T or a Error.
Error takeError()
Take ownership of the stored error.
reference get()
Returns a reference to the stored T value.
This is an important class for using LLVM in a threaded context.
A Module instance is used to store all the information related to an LLVM module.
LLVMBool LLVMParseBitcodeInContext2(LLVMContextRef ContextRef, LLVMMemoryBufferRef MemBuf, LLVMModuleRef *OutModule)
Definition BitReader.cpp:58
LLVMBool LLVMGetBitcodeModuleInContext(LLVMContextRef ContextRef, LLVMMemoryBufferRef MemBuf, LLVMModuleRef *OutM, char **OutMessage)
Reads a module from the specified path, returning via the OutMP parameter a module provider which per...
Definition BitReader.cpp:78
LLVMBool LLVMParseBitcodeInContext(LLVMContextRef ContextRef, LLVMMemoryBufferRef MemBuf, LLVMModuleRef *OutModule, char **OutMessage)
Definition BitReader.cpp:35
LLVMBool LLVMGetBitcodeModuleInContext2(LLVMContextRef ContextRef, LLVMMemoryBufferRef MemBuf, LLVMModuleRef *OutM)
Reads a module from the given memory buffer, returning via the OutMP parameter a module provider whic...
Definition BitReader.cpp:105
struct LLVMOpaqueMemoryBuffer * LLVMMemoryBufferRef
LLVM uses a polymorphic type hierarchy which C cannot represent, therefore parameters must be passed ...
struct LLVMOpaqueContext * LLVMContextRef
The top-level container for all LLVM global data.
struct LLVMOpaqueModule * LLVMModuleRef
The top-level container for all other LLVM Intermediate Representation (IR) objects.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI Expected< std::unique_ptr< Module > > parseBitcodeFile(MemoryBufferRef Buffer, LLVMContext &Context, ParserCallbacks Callbacks={})
Read the specified bitcode file, returning the module.
void handleAllErrors(Error E, HandlerTs &&... Handlers)
Behaves the same as handleErrors, except that by contract all errors must be handled by the given han...
ErrorOr< T > expectedToErrorOrAndEmitErrors(LLVMContext &Ctx, Expected< T > Val)
LLVM_ABI LLVMContextRef getGlobalContextForCAPI()
Get the deprecated global context for use by the C API.
Attribute unwrap(LLVMAttributeRef Attr)
LLVMAttributeRef wrap(Attribute Attr)
LLVM_ABI Expected< std::unique_ptr< Module > > getOwningLazyBitcodeModule(std::unique_ptr< MemoryBuffer > &&Buffer, LLVMContext &Context, bool ShouldLazyLoadMetadata=false, bool IsImporting=false, ParserCallbacks Callbacks={})
Like getLazyBitcodeModule, except that the module takes ownership of the memory buffer if successful.