LLVM  17.0.0git
BitcodeReader.h
Go to the documentation of this file.
1 //===- llvm/Bitcode/BitcodeReader.h - Bitcode reader ------------*- 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 // This header defines interfaces to read LLVM bitcode files/streams.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_BITCODE_BITCODEREADER_H
14 #define LLVM_BITCODE_BITCODEREADER_H
15 
16 #include "llvm/ADT/ArrayRef.h"
17 #include "llvm/ADT/StringRef.h"
19 #include "llvm/IR/GlobalValue.h"
20 #include "llvm/Support/Endian.h"
21 #include "llvm/Support/Error.h"
22 #include "llvm/Support/ErrorOr.h"
24 #include <cstdint>
25 #include <memory>
26 #include <optional>
27 #include <string>
28 #include <system_error>
29 #include <vector>
30 namespace llvm {
31 
32 class LLVMContext;
33 class Module;
34 class MemoryBuffer;
35 class Metadata;
36 class ModuleSummaryIndex;
37 class Type;
38 class Value;
39 
40 // Callback to override the data layout string of an imported bitcode module.
41 // The first argument is the target triple, the second argument the data layout
42 // string from the input, or a default string. It will be used if the callback
43 // returns std::nullopt.
44 typedef std::function<std::optional<std::string>(StringRef, StringRef)>
46 
47 typedef std::function<Type *(unsigned)> GetTypeByIDTy;
48 
49 typedef std::function<unsigned(unsigned, unsigned)> GetContainedTypeIDTy;
50 
51 typedef std::function<void(Value *, unsigned, GetTypeByIDTy,
54 
55 typedef std::function<void(Metadata **, unsigned, GetTypeByIDTy,
58 
59 // These functions are for converting Expected/Error values to
60 // ErrorOr/std::error_code for compatibility with legacy clients. FIXME:
61 // Remove these functions once no longer needed by the C and libLTO APIs.
62 
63 std::error_code errorToErrorCodeAndEmitErrors(LLVMContext &Ctx, Error Err);
64 
65 template <typename T>
67  if (!Val)
68  return errorToErrorCodeAndEmitErrors(Ctx, Val.takeError());
69  return std::move(*Val);
70 }
71 
73  std::optional<DataLayoutCallbackFuncTy> DataLayout;
74  /// The ValueType callback is called for every function definition or
75  /// declaration and allows accessing the type information, also behind
76  /// pointers. This can be useful, when the opaque pointer upgrade cleans all
77  /// type information behind pointers.
78  /// The second argument to ValueTypeCallback is the type ID of the
79  /// function, the two passed functions can be used to extract type
80  /// information.
81  std::optional<ValueTypeCallbackTy> ValueType;
82  /// The MDType callback is called for every value in metadata.
83  std::optional<MDTypeCallbackTy> MDType;
84 
85  ParserCallbacks() = default;
88 };
89 
90  struct BitcodeFileContents;
91 
92  /// Basic information extracted from a bitcode module to be used for LTO.
93  struct BitcodeLTOInfo {
94  bool IsThinLTO;
95  bool HasSummary;
97  };
98 
99  /// Represents a module in a bitcode file.
101  // This covers the identification (if present) and module blocks.
102  ArrayRef<uint8_t> Buffer;
103  StringRef ModuleIdentifier;
104 
105  // The string table used to interpret this module.
106  StringRef Strtab;
107 
108  // The bitstream location of the IDENTIFICATION_BLOCK.
109  uint64_t IdentificationBit;
110 
111  // The bitstream location of this module's MODULE_BLOCK.
112  uint64_t ModuleBit;
113 
114  BitcodeModule(ArrayRef<uint8_t> Buffer, StringRef ModuleIdentifier,
115  uint64_t IdentificationBit, uint64_t ModuleBit)
116  : Buffer(Buffer), ModuleIdentifier(ModuleIdentifier),
117  IdentificationBit(IdentificationBit), ModuleBit(ModuleBit) {}
118 
119  // Calls the ctor.
122 
124  getModuleImpl(LLVMContext &Context, bool MaterializeAll,
125  bool ShouldLazyLoadMetadata, bool IsImporting,
126  ParserCallbacks Callbacks = {});
127 
128  public:
130  return StringRef((const char *)Buffer.begin(), Buffer.size());
131  }
132 
133  StringRef getStrtab() const { return Strtab; }
134 
135  StringRef getModuleIdentifier() const { return ModuleIdentifier; }
136 
137  /// Read the bitcode module and prepare for lazy deserialization of function
138  /// bodies. If ShouldLazyLoadMetadata is true, lazily load metadata as well.
139  /// If IsImporting is true, this module is being parsed for ThinLTO
140  /// importing into another module.
142  getLazyModule(LLVMContext &Context, bool ShouldLazyLoadMetadata,
143  bool IsImporting, ParserCallbacks Callbacks = {});
144 
145  /// Read the entire bitcode module and return it.
146  Expected<std::unique_ptr<Module>>
147  parseModule(LLVMContext &Context, ParserCallbacks Callbacks = {});
148 
149  /// Returns information about the module to be used for LTO: whether to
150  /// compile with ThinLTO, and whether it has a summary.
151  Expected<BitcodeLTOInfo> getLTOInfo();
152 
153  /// Parse the specified bitcode buffer, returning the module summary index.
154  Expected<std::unique_ptr<ModuleSummaryIndex>> getSummary();
155 
156  /// Parse the specified bitcode buffer and merge its module summary index
157  /// into CombinedIndex.
158  Error
159  readSummary(ModuleSummaryIndex &CombinedIndex, StringRef ModulePath,
160  uint64_t ModuleId,
161  std::function<bool(GlobalValue::GUID)> IsPrevailing = nullptr);
162  };
163 
165  std::vector<BitcodeModule> Mods;
167  };
168 
169  /// Returns the contents of a bitcode file. This includes the raw contents of
170  /// the symbol table embedded in the bitcode file. Clients which require a
171  /// symbol table should prefer to use irsymtab::read instead of this function
172  /// because it creates a reader for the irsymtab and handles upgrading bitcode
173  /// files without a symbol table or with an old symbol table.
175 
176  /// Returns a list of modules in the specified bitcode buffer.
179 
180  /// Read the header of the specified bitcode buffer and prepare for lazy
181  /// deserialization of function bodies. If ShouldLazyLoadMetadata is true,
182  /// lazily load metadata as well. If IsImporting is true, this module is
183  /// being parsed for ThinLTO importing into another module.
186  bool ShouldLazyLoadMetadata = false,
187  bool IsImporting = false,
188  ParserCallbacks Callbacks = {});
189 
190  /// Like getLazyBitcodeModule, except that the module takes ownership of
191  /// the memory buffer if successful. If successful, this moves Buffer. On
192  /// error, this *does not* move Buffer. If IsImporting is true, this module is
193  /// being parsed for ThinLTO importing into another module.
194  Expected<std::unique_ptr<Module>> getOwningLazyBitcodeModule(
195  std::unique_ptr<MemoryBuffer> &&Buffer, LLVMContext &Context,
196  bool ShouldLazyLoadMetadata = false, bool IsImporting = false,
197  ParserCallbacks Callbacks = {});
198 
199  /// Read the header of the specified bitcode buffer and extract just the
200  /// triple information. If successful, this returns a string. On error, this
201  /// returns "".
202  Expected<std::string> getBitcodeTargetTriple(MemoryBufferRef Buffer);
203 
204  /// Return true if \p Buffer contains a bitcode file with ObjC code (category
205  /// or class) in it.
206  Expected<bool> isBitcodeContainingObjCCategory(MemoryBufferRef Buffer);
207 
208  /// Read the header of the specified bitcode buffer and extract just the
209  /// producer string information. If successful, this returns a string. On
210  /// error, this returns "".
211  Expected<std::string> getBitcodeProducerString(MemoryBufferRef Buffer);
212 
213  /// Read the specified bitcode file, returning the module.
214  Expected<std::unique_ptr<Module>>
215  parseBitcodeFile(MemoryBufferRef Buffer, LLVMContext &Context,
216  ParserCallbacks Callbacks = {});
217 
218  /// Returns LTO information for the specified bitcode file.
219  Expected<BitcodeLTOInfo> getBitcodeLTOInfo(MemoryBufferRef Buffer);
220 
221  /// Parse the specified bitcode buffer, returning the module summary index.
222  Expected<std::unique_ptr<ModuleSummaryIndex>>
223  getModuleSummaryIndex(MemoryBufferRef Buffer);
224 
225  /// Parse the specified bitcode buffer and merge the index into CombinedIndex.
226  Error readModuleSummaryIndex(MemoryBufferRef Buffer,
227  ModuleSummaryIndex &CombinedIndex,
228  uint64_t ModuleId);
229 
230  /// Parse the module summary index out of an IR file and return the module
231  /// summary index object if found, or an empty summary if not. If Path refers
232  /// to an empty file and IgnoreEmptyThinLTOIndexFile is true, then
233  /// this function will return nullptr.
234  Expected<std::unique_ptr<ModuleSummaryIndex>>
235  getModuleSummaryIndexForFile(StringRef Path,
236  bool IgnoreEmptyThinLTOIndexFile = false);
237 
238  /// isBitcodeWrapper - Return true if the given bytes are the magic bytes
239  /// for an LLVM IR bitcode wrapper.
240  inline bool isBitcodeWrapper(const unsigned char *BufPtr,
241  const unsigned char *BufEnd) {
242  // See if you can find the hidden message in the magic bytes :-).
243  // (Hint: it's a little-endian encoding.)
244  return BufPtr != BufEnd &&
245  BufPtr[0] == 0xDE &&
246  BufPtr[1] == 0xC0 &&
247  BufPtr[2] == 0x17 &&
248  BufPtr[3] == 0x0B;
249  }
250 
251  /// isRawBitcode - Return true if the given bytes are the magic bytes for
252  /// raw LLVM IR bitcode (without a wrapper).
253  inline bool isRawBitcode(const unsigned char *BufPtr,
254  const unsigned char *BufEnd) {
255  // These bytes sort of have a hidden message, but it's not in
256  // little-endian this time, and it's a little redundant.
257  return BufPtr != BufEnd &&
258  BufPtr[0] == 'B' &&
259  BufPtr[1] == 'C' &&
260  BufPtr[2] == 0xc0 &&
261  BufPtr[3] == 0xde;
262  }
263 
264  /// isBitcode - Return true if the given bytes are the magic bytes for
265  /// LLVM IR bitcode, either with or without a wrapper.
266  inline bool isBitcode(const unsigned char *BufPtr,
267  const unsigned char *BufEnd) {
268  return isBitcodeWrapper(BufPtr, BufEnd) ||
269  isRawBitcode(BufPtr, BufEnd);
270  }
271 
272  /// SkipBitcodeWrapperHeader - Some systems wrap bc files with a special
273  /// header for padding or other reasons. The format of this header is:
274  ///
275  /// struct bc_header {
276  /// uint32_t Magic; // 0x0B17C0DE
277  /// uint32_t Version; // Version, currently always 0.
278  /// uint32_t BitcodeOffset; // Offset to traditional bitcode file.
279  /// uint32_t BitcodeSize; // Size of traditional bitcode file.
280  /// ... potentially other gunk ...
281  /// };
282  ///
283  /// This function is called when we find a file with a matching magic number.
284  /// In this case, skip down to the subsection of the file that is actually a
285  /// BC file.
286  /// If 'VerifyBufferSize' is true, check that the buffer is large enough to
287  /// contain the whole bitcode file.
288  inline bool SkipBitcodeWrapperHeader(const unsigned char *&BufPtr,
289  const unsigned char *&BufEnd,
290  bool VerifyBufferSize) {
291  // Must contain the offset and size field!
292  if (unsigned(BufEnd - BufPtr) < BWH_SizeField + 4)
293  return true;
294 
295  unsigned Offset = support::endian::read32le(&BufPtr[BWH_OffsetField]);
296  unsigned Size = support::endian::read32le(&BufPtr[BWH_SizeField]);
297  uint64_t BitcodeOffsetEnd = (uint64_t)Offset + (uint64_t)Size;
298 
299  // Verify that Offset+Size fits in the file.
300  if (VerifyBufferSize && BitcodeOffsetEnd > uint64_t(BufEnd-BufPtr))
301  return true;
302  BufPtr += Offset;
303  BufEnd = BufPtr+Size;
304  return false;
305  }
306 
307  APInt readWideAPInt(ArrayRef<uint64_t> Vals, unsigned TypeBits);
308 
309  const std::error_category &BitcodeErrorCategory();
310  enum class BitcodeError { CorruptedBitcode = 1 };
311  inline std::error_code make_error_code(BitcodeError E) {
312  return std::error_code(static_cast<int>(E), BitcodeErrorCategory());
313  }
314 
315 } // end namespace llvm
316 
317 namespace std {
318 
319 template <> struct is_error_code_enum<llvm::BitcodeError> : std::true_type {};
320 
321 } // end namespace std
322 
323 #endif // LLVM_BITCODE_BITCODEREADER_H
llvm::GlobalValue::GUID
uint64_t GUID
Declare a type to represent a global unique identifier for a global value.
Definition: GlobalValue.h:583
llvm::expectedToErrorOrAndEmitErrors
ErrorOr< T > expectedToErrorOrAndEmitErrors(LLVMContext &Ctx, Expected< T > Val)
Definition: BitcodeReader.h:66
llvm::BitcodeError::CorruptedBitcode
@ CorruptedBitcode
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::BitcodeModule::getBuffer
StringRef getBuffer() const
Definition: BitcodeReader.h:129
llvm::lltok::Error
@ Error
Definition: LLToken.h:21
llvm::DataLayout
A parsed version of the target data layout string in and methods for querying it.
Definition: DataLayout.h:114
BitCodeEnums.h
StringRef.h
llvm::getBitcodeProducerString
Expected< std::string > getBitcodeProducerString(MemoryBufferRef Buffer)
Read the header of the specified bitcode buffer and extract just the producer string information.
Definition: BitcodeReader.cpp:8184
llvm::ParserCallbacks::MDType
std::optional< MDTypeCallbackTy > MDType
The MDType callback is called for every value in metadata.
Definition: BitcodeReader.h:83
llvm::SkipBitcodeWrapperHeader
bool SkipBitcodeWrapperHeader(const unsigned char *&BufPtr, const unsigned char *&BufEnd, bool VerifyBufferSize)
SkipBitcodeWrapperHeader - Some systems wrap bc files with a special header for padding or other reas...
Definition: BitcodeReader.h:288
Error.h
llvm::BitcodeModule::getLazyModule
Expected< std::unique_ptr< Module > > getLazyModule(LLVMContext &Context, bool ShouldLazyLoadMetadata, bool IsImporting, ParserCallbacks Callbacks={})
Read the bitcode module and prepare for lazy deserialization of function bodies.
Definition: BitcodeReader.cpp:7982
MemoryBufferRef.h
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
llvm::BitcodeFileContents::Symtab
StringRef Symtab
Definition: BitcodeReader.h:166
llvm::readWideAPInt
APInt readWideAPInt(ArrayRef< uint64_t > Vals, unsigned TypeBits)
Definition: BitcodeReader.cpp:2955
llvm::parseBitcodeFile
Expected< std::unique_ptr< Module > > parseBitcodeFile(MemoryBufferRef Buffer, LLVMContext &Context, ParserCallbacks Callbacks={})
Read the specified bitcode file, returning the module.
Definition: BitcodeReader.cpp:8159
llvm::Expected
Tagged union holding either a T or a Error.
Definition: APFloat.h:41
llvm::getModuleSummaryIndex
Expected< std::unique_ptr< ModuleSummaryIndex > > getModuleSummaryIndex(MemoryBufferRef Buffer)
Parse the specified bitcode buffer, returning the module summary index.
Definition: BitcodeReader.cpp:8203
llvm::MemoryBufferRef
Definition: MemoryBufferRef.h:22
llvm::BitcodeModule::getModuleIdentifier
StringRef getModuleIdentifier() const
Definition: BitcodeReader.h:135
Context
LLVMContext & Context
Definition: NVVMIntrRange.cpp:66
GlobalValue.h
llvm::BitcodeLTOInfo
Basic information extracted from a bitcode module to be used for LTO.
Definition: BitcodeReader.h:93
llvm::readModuleSummaryIndex
Error readModuleSummaryIndex(MemoryBufferRef Buffer, ModuleSummaryIndex &CombinedIndex, uint64_t ModuleId)
Parse the specified bitcode buffer and merge the index into CombinedIndex.
Definition: BitcodeReader.cpp:8192
llvm::getBitcodeFileContents
Expected< BitcodeFileContents > getBitcodeFileContents(MemoryBufferRef Buffer)
Returns the contents of a bitcode file.
Definition: BitcodeReader.cpp:7824
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
llvm::BitcodeModule::getLTOInfo
Expected< BitcodeLTOInfo > getLTOInfo()
Returns information about the module to be used for LTO: whether to compile with ThinLTO,...
Definition: BitcodeReader.cpp:8065
llvm::isRawBitcode
bool isRawBitcode(const unsigned char *BufPtr, const unsigned char *BufEnd)
isRawBitcode - Return true if the given bytes are the magic bytes for raw LLVM IR bitcode (without a ...
Definition: BitcodeReader.h:253
llvm::BWH_OffsetField
@ BWH_OffsetField
Definition: BitCodeEnums.h:29
llvm::ParserCallbacks::ParserCallbacks
ParserCallbacks()=default
llvm::DataLayoutCallbackFuncTy
std::function< std::optional< std::string >StringRef, StringRef)> DataLayoutCallbackFuncTy
Definition: BitcodeReader.h:38
llvm::ParserCallbacks::ValueType
std::optional< ValueTypeCallbackTy > ValueType
The ValueType callback is called for every function definition or declaration and allows accessing th...
Definition: BitcodeReader.h:81
llvm::isBitcode
bool isBitcode(const unsigned char *BufPtr, const unsigned char *BufEnd)
isBitcode - Return true if the given bytes are the magic bytes for LLVM IR bitcode,...
Definition: BitcodeReader.h:266
llvm::Metadata
Root of the metadata hierarchy.
Definition: Metadata.h:61
llvm::BitcodeFileContents
Definition: BitcodeReader.h:164
llvm::errorToErrorCodeAndEmitErrors
std::error_code errorToErrorCodeAndEmitErrors(LLVMContext &Ctx, Error Err)
Definition: BitcodeReader.cpp:956
llvm::BWH_SizeField
@ BWH_SizeField
Definition: BitCodeEnums.h:30
llvm::BitcodeError
BitcodeError
Definition: BitcodeReader.h:310
llvm::BitcodeLTOInfo::HasSummary
bool HasSummary
Definition: BitcodeReader.h:95
llvm::BitcodeModule::getBitcodeFileContents
friend Expected< BitcodeFileContents > getBitcodeFileContents(MemoryBufferRef Buffer)
Returns the contents of a bitcode file.
llvm::ParserCallbacks::DataLayout
std::optional< DataLayoutCallbackFuncTy > DataLayout
Definition: BitcodeReader.h:73
llvm::ParserCallbacks
Definition: BitcodeReader.h:72
llvm::getLazyBitcodeModule
Expected< std::unique_ptr< Module > > getLazyBitcodeModule(MemoryBufferRef Buffer, LLVMContext &Context, bool ShouldLazyLoadMetadata=false, bool IsImporting=false, ParserCallbacks Callbacks={})
Read the header of the specified bitcode buffer and prepare for lazy deserialization of function bodi...
Definition: BitcodeReader.cpp:8130
uint64_t
llvm::ParserCallbacks::ParserCallbacks
ParserCallbacks(DataLayoutCallbackFuncTy DataLayout)
Definition: BitcodeReader.h:86
llvm::ValueTypeCallbackTy
std::function< void(Value *, unsigned, GetTypeByIDTy, GetContainedTypeIDTy)> ValueTypeCallbackTy
Definition: BitcodeReader.h:53
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
llvm::LLVMContext
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:67
llvm::BitcodeErrorCategory
const std::error_category & BitcodeErrorCategory()
Definition: BitcodeReader.cpp:7768
ErrorOr.h
ArrayRef.h
TemplateParamKind::Type
@ Type
llvm::getModuleSummaryIndexForFile
Expected< std::unique_ptr< ModuleSummaryIndex > > getModuleSummaryIndexForFile(StringRef Path, bool IgnoreEmptyThinLTOIndexFile=false)
Parse the module summary index out of an IR file and return the module summary index object if found,...
Definition: BitcodeReader.cpp:8220
llvm::GetContainedTypeIDTy
std::function< unsigned(unsigned, unsigned)> GetContainedTypeIDTy
Definition: BitcodeReader.h:49
llvm::BitcodeModule::readSummary
Error readSummary(ModuleSummaryIndex &CombinedIndex, StringRef ModulePath, uint64_t ModuleId, std::function< bool(GlobalValue::GUID)> IsPrevailing=nullptr)
Parse the specified bitcode buffer and merge its module summary index into CombinedIndex.
Definition: BitcodeReader.cpp:7992
llvm::MDTypeCallbackTy
std::function< void(Metadata **, unsigned, GetTypeByIDTy, GetContainedTypeIDTy)> MDTypeCallbackTy
Definition: BitcodeReader.h:57
function
print Print MemDeps of function
Definition: MemDepPrinter.cpp:82
llvm::BitcodeModule::parseModule
Expected< std::unique_ptr< Module > > parseModule(LLVMContext &Context, ParserCallbacks Callbacks={})
Read the entire bitcode module and return it.
Definition: BitcodeReader.cpp:8152
llvm::BitcodeFileContents::Mods
std::vector< BitcodeModule > Mods
Definition: BitcodeReader.h:165
llvm::BitcodeModule::getSummary
Expected< std::unique_ptr< ModuleSummaryIndex > > getSummary()
Parse the specified bitcode buffer, returning the module summary index.
Definition: BitcodeReader.cpp:8005
llvm::ArrayRef< uint8_t >
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
llvm::Offset
@ Offset
Definition: DWP.cpp:406
llvm::getBitcodeTargetTriple
Expected< std::string > getBitcodeTargetTriple(MemoryBufferRef Buffer)
Read the header of the specified bitcode buffer and extract just the triple information.
Definition: BitcodeReader.cpp:8168
Module
Machine Check Debug Module
Definition: MachineCheckDebugify.cpp:122
llvm::make_error_code
std::error_code make_error_code(BitcodeError E)
Definition: BitcodeReader.h:311
std
Definition: BitVector.h:851
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:156
llvm::BitcodeLTOInfo::EnableSplitLTOUnit
bool EnableSplitLTOUnit
Definition: BitcodeReader.h:96
llvm::isBitcodeWrapper
bool isBitcodeWrapper(const unsigned char *BufPtr, const unsigned char *BufEnd)
isBitcodeWrapper - Return true if the given bytes are the magic bytes for an LLVM IR bitcode wrapper.
Definition: BitcodeReader.h:240
llvm::BitcodeModule::getStrtab
StringRef getStrtab() const
Definition: BitcodeReader.h:133
llvm::BitcodeFileContents::StrtabForSymtab
StringRef StrtabForSymtab
Definition: BitcodeReader.h:166
llvm::Expected::takeError
Error takeError()
Take ownership of the stored error.
Definition: Error.h:597
llvm::support::endian::read32le
uint32_t read32le(const void *P)
Definition: Endian.h:381
LineType::Metadata
@ Metadata
llvm::ErrorOr
Represents either an error or a value T.
Definition: ErrorOr.h:56
llvm::getBitcodeLTOInfo
Expected< BitcodeLTOInfo > getBitcodeLTOInfo(MemoryBufferRef Buffer)
Returns LTO information for the specified bitcode file.
Definition: BitcodeReader.cpp:8211
llvm::getBitcodeModuleList
Expected< std::vector< BitcodeModule > > getBitcodeModuleList(MemoryBufferRef Buffer)
Returns a list of modules in the specified bitcode buffer.
Definition: BitcodeReader.cpp:7816
llvm::BitcodeModule
Represents a module in a bitcode file.
Definition: BitcodeReader.h:100
Endian.h
llvm::Value
LLVM Value Representation.
Definition: Value.h:74
llvm::isBitcodeContainingObjCCategory
Expected< bool > isBitcodeContainingObjCCategory(MemoryBufferRef Buffer)
Return true if Buffer contains a bitcode file with ObjC code (category or class) in it.
Definition: BitcodeReader.cpp:8176
llvm::GetTypeByIDTy
std::function< Type *(unsigned)> GetTypeByIDTy
Definition: BitcodeReader.h:47
llvm::BitcodeLTOInfo::IsThinLTO
bool IsThinLTO
Definition: BitcodeReader.h:94
llvm::getOwningLazyBitcodeModule
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.
Definition: BitcodeReader.cpp:8141