LLVM: lib/ExecutionEngine/Orc/ExecutionUtils.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

24#include

25

26namespace llvm {

27namespace orc {

28

30 : InitList(

32 I((InitList && End) ? InitList->getNumOperands() : 0) {

33}

34

36 assert(InitList == Other.InitList && "Incomparable iterators.");

37 return I == Other.I;

38}

39

41 return !(*this == Other);

42}

43

45 ++I;

46 return *this;

47}

48

51 ++I;

52 return Temp;

53}

54

57 assert(CS && "Unrecognized type in llvm.global_ctors/llvm.global_dtors");

58

61

62

63 while (FuncC) {

65 Func = F;

66 break;

68 if (CE->isCast())

69 FuncC = CE->getOperand(0);

70 else

71 break;

72 } else {

73

74 break;

75 }

76 }

77

81 Data = nullptr;

82 return Element(Priority->getZExtValue(), Func, Data);

83}

84

86 const GlobalVariable *CtorsList = M.getNamedGlobal("llvm.global_ctors");

89}

90

92 const GlobalVariable *DtorsList = M.getNamedGlobal("llvm.global_dtors");

95}

96

97bool StaticInitGVIterator::isStaticInitGlobal(GlobalValue &GV) {

99 return false;

100

101 if (GV.hasName() && (GV.getName() == "llvm.global_ctors" ||

102 GV.getName() == "llvm.global_dtors"))

103 return true;

104

106

107

111 return true;

112 }

113

114 return false;

115}

116

118 if (CtorDtors.empty())

119 return;

120

122 JD.getExecutionSession(),

123 (*CtorDtors.begin()).Func->getDataLayout());

124

125 for (auto CtorDtor : CtorDtors) {

126 assert(CtorDtor.Func && CtorDtor.Func->hasName() &&

127 "Ctor/Dtor function must be named to be runnable under the JIT");

128

129

130 if (CtorDtor.Func->hasLocalLinkage()) {

133 }

134

135 if (CtorDtor.Data && cast(CtorDtor.Data)->isDeclaration())

136 continue;

137

138 CtorDtorsByPriority[CtorDtor.Priority].push_back(

139 Mangle(CtorDtor.Func->getName()));

140 }

141}

142

144 using CtorDtorTy = void (*)();

145

147 for (auto &KV : CtorDtorsByPriority)

148 for (auto &Name : KV.second)

149 LookupSet.add(Name);

151 "Ctor/Dtor list contains duplicates");

152

153 auto &ES = JD.getExecutionSession();

154 if (auto CtorDtorMap = ES.lookup(

156 std::move(LookupSet))) {

157 for (auto &KV : CtorDtorsByPriority) {

158 for (auto &Name : KV.second) {

159 assert(CtorDtorMap->count(Name) && "No entry for Name");

160 auto CtorDtor = (*CtorDtorMap)[Name].getAddress().toPtr();

161 CtorDtor();

162 }

163 }

164 CtorDtorsByPriority.clear();

166 } else

167 return CtorDtorMap.takeError();

168}

169

172 for (auto &P : CXXDestructorDataPairs)

173 P.first(P.second);

174 CXXDestructorDataPairs.clear();

175}

176

178 void *Arg,

179 void *DSOHandle) {

180 auto& CXXDestructorDataPairs =

182 CXXDestructorDataPairs.push_back(std::make_pair(Destructor, Arg));

183 return 0;

184}

185

189 RuntimeInterposes[Mangle("__dso_handle")] = {

191 RuntimeInterposes[Mangle("__cxa_atexit")] = {

193

195}

196

198 void *DSOHandle) {

199 std::lock_guardstd::mutex Lock(AtExitsMutex);

200 AtExitRecords[DSOHandle].push_back({F, Ctx});

201}

202

204 std::vector AtExitsToRun;

205

206 {

207 std::lock_guardstd::mutex Lock(AtExitsMutex);

208 auto I = AtExitRecords.find(DSOHandle);

209 if (I != AtExitRecords.end()) {

210 AtExitsToRun = std::move(I->second);

211 AtExitRecords.erase(I);

212 }

213 }

214

215 while (!AtExitsToRun.empty()) {

216 AtExitsToRun.back().F(AtExitsToRun.back().Ctx);

217 AtExitsToRun.pop_back();

218 }

219}

220

225 AddAbsoluteSymbols(std::move(AddAbsoluteSymbols)),

226 GlobalPrefix(GlobalPrefix) {}

227

232 std::string ErrMsg;

234 if (Lib.isValid())

236 return std::make_unique(

237 std::move(Lib), GlobalPrefix, std::move(Allow),

238 std::move(AddAbsoluteSymbols));

239}

240

245

246 bool HasGlobalPrefix = (GlobalPrefix != '\0');

247

248 for (auto &KV : Symbols) {

249 auto &Name = KV.first;

250

251 if ((*Name).empty())

252 continue;

253

254 if (Allow && !Allow(Name))

255 continue;

256

257 if (HasGlobalPrefix && (*Name).front() != GlobalPrefix)

258 continue;

259

260 std::string Tmp((*Name).data() + HasGlobalPrefix,

261 (*Name).size() - HasGlobalPrefix);

262 if (void *P = Dylib.getAddressOfSymbol(Tmp.c_str()))

264 }

265

266 if (NewSymbols.empty())

268

269 if (AddAbsoluteSymbols)

270 return AddAbsoluteSymbols(JD, std::move(NewSymbols));

272}

273

284 return std::move(Err);

285

286 return false;

287 default:

288

289 return false;

290 }

291 };

292}

293

298

299 const auto &TT = L.getExecutionSession().getTargetTriple();

301 if (!Linkable)

302 return Linkable.takeError();

303

304 return Create(L, std::move(Linkable->first), std::move(VisitMembers),

305 std::move(GetObjFileInterface));

306}

307

310 ObjectLayer &L, std::unique_ptr ArchiveBuffer,

313

315

316 if (VisitMembers) {

317 size_t Index = 0;

319 for (auto Child : Archive->children(Err)) {

320 if (auto ChildBuf = Child.getMemoryBufferRef()) {

321 if (auto Loadable = VisitMembers(*Archive, *ChildBuf, Index++)) {

322 if (!*Loadable)

323 Excluded.insert(Child.getDataOffset());

324 } else

325 return Loadable.takeError();

326 } else {

327

328

330 }

331 }

332 if (Err)

333 return std::move(Err);

334 }

335

337 {

339 size_t Index = 0;

341 for (auto &Child : Archive->children(Err)) {

342

343 if (!Excluded.count(Child.getDataOffset()))

344 OffsetToIndex[Child.getDataOffset()] = Index;

345 ++Index;

346 }

347 if (Err)

348 return Err;

349

350 auto &ES = L.getExecutionSession();

351 for (auto &Sym : Archive->symbols()) {

352 auto Member = Sym.getMember();

353 if (!Member)

354 return Member.takeError();

355 auto EntryItr = OffsetToIndex.find(Member->getDataOffset());

356

357

358 if (EntryItr == OffsetToIndex.end())

359 continue;

360

361 SymbolToMemberIndexMap[ES.intern(Sym.getName())] = EntryItr->second;

362 }

363 }

364

365 return std::unique_ptr(

366 new StaticLibraryDefinitionGenerator(

367 L, std::move(ArchiveBuffer), std::move(Archive),

368 std::move(GetObjFileInterface), std::move(SymbolToMemberIndexMap)));

369}

370

373 ObjectLayer &L, std::unique_ptr ArchiveBuffer,

376

378 if (B)

379 return B.takeError();

380

381

383 return Create(L, std::move(ArchiveBuffer),

384 std::unique_ptrobject::Archive(

386 std::move(VisitMembers), std::move(GetObjFileInterface));

387

388

389

391

392 const auto &TT = L.getExecutionSession().getTargetTriple();

393

395 if (!SliceRange)

396 return SliceRange.takeError();

397

399 StringRef(ArchiveBuffer->getBufferStart() + SliceRange->first,

400 SliceRange->second),

401 ArchiveBuffer->getBufferIdentifier());

402

404 if (!Archive)

405 return Archive.takeError();

406

407 return Create(L, std::move(ArchiveBuffer), std::move(*Archive),

408 std::move(VisitMembers), std::move(GetObjFileInterface));

409 }

410

412 ArchiveBuffer->getBufferIdentifier(),

414}

415

419

420

423

424

425 if (!Archive)

427

429

430 for (const auto &[Name, _] : Symbols) {

431

432 auto It = SymbolToMemberIndexMap.find(Name);

433 if (It == SymbolToMemberIndexMap.end())

434 continue;

435 size_t Index = It->second;

436

437

438

439 if (ToLoad.count(Index))

440 continue;

441

442 auto Member = Archive->findSym(*Name);

443 if (!Member)

444 return Member.takeError();

445 if (!*Member)

446 continue;

447

448 auto MemberBuf = (*Member)->getMemoryBufferRef();

449 if (!MemberBuf)

450 return MemberBuf.takeError();

451

452 ToLoad[Index] = *MemberBuf;

453 }

454

455

456 {

457

458 std::vector ToRemove;

459 for (auto &[Name, Index] : SymbolToMemberIndexMap)

460 if (ToLoad.count(Index))

463 SymbolToMemberIndexMap.erase(Name);

464 }

465

466

467 for (auto &[Index, Buf] : ToLoad) {

469

470 auto Interface = GetObjFileInterface(L.getExecutionSession(),

471 MemberBuf->getMemBufferRef());

472 if (!Interface)

473 return Interface.takeError();

474

475 if (auto Err = L.add(JD, std::move(MemberBuf), std::move(*Interface)))

476 return Err;

477 }

478

480}

481

482std::unique_ptr

485 size_t Index) {

487 (A.getFileName() + "[" + Twine(Index) +

490 false);

491}

492

493StaticLibraryDefinitionGenerator::StaticLibraryDefinitionGenerator(

494 ObjectLayer &L, std::unique_ptr ArchiveBuffer,

495 std::unique_ptrobject::Archive Archive,

496 GetObjectFileInterface GetObjFileInterface,

498 : L(L), GetObjFileInterface(std::move(GetObjFileInterface)),

500 SymbolToMemberIndexMap(std::move(SymbolToMemberIndexMap)) {

501 if (!this->GetObjFileInterface)

503}

504

505std::unique_ptr

508 return std::unique_ptr(

509 new DLLImportDefinitionGenerator(ES, L));

510}

511

517 LinkOrder.reserve(LO.size());

518 for (auto &KV : LO) {

519 if (KV.first == &JD)

520 continue;

521 LinkOrder.push_back(KV);

522 }

523 });

524

525

526

527

530 for (auto &KV : Symbols) {

531 StringRef Deinterned = *KV.first;

532 if (Deinterned.starts_with(getImpPrefix()))

534

535 auto [It, Inserted] = ToLookUpSymbols.try_emplace(Deinterned);

537 It->second = KV.second;

538 }

539

540 for (auto &KV : ToLookUpSymbols)

541 LookupSet.add(ES.intern(KV.first), KV.second);

542

547

548 auto G = createStubsGraph(*Resolved);

549 if (G)

550 return G.takeError();

551 return L.add(JD, std::move(*G));

552}

553

555DLLImportDefinitionGenerator::createStubsGraph(const SymbolMap &Resolved) {

556 auto G = std::make_uniquejitlink::LinkGraph(

561

564 *KV.first, KV.second.getAddress(), G->getPointerSize(),

566

567

570 Ptr.setName(G->intern((Twine(getImpPrefix()) + *KV.first).str()));

573

574

575

578 G->addDefinedSymbol(StubBlock, 0, *KV.first, StubBlock.getSize(),

580 false);

581 }

582

583 return std::move(G);

584}

585

586}

587}

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

ReachingDefInfo InstSet & ToRemove

static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")

static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")

This file contains the declarations for the subclasses of Constant, which represent the different fla...

Module.h This file contains the declarations for the Module class.

ConstantArray - Constant Array Declarations.

A constant value that is initialized with an expression using other constant values.

This is an important base class in LLVM.

iterator find(const_arg_type_t< KeyT > Val)

std::pair< iterator, bool > try_emplace(KeyT &&Key, Ts &&...Args)

size_type count(const_arg_type_t< KeyT > Val) const

Return 1 if the specified key is in the map, 0 otherwise.

Implements a dense probed hash-table based set.

Lightweight error class with error context and mandatory checking.

static ErrorSuccess success()

Create a success value.

Tagged union holding either a T or a Error.

LLVM_ABI bool isDeclaration() const

Return true if the primary definition of this global value is outside of the current translation unit...

LLVM_ABI StringRef getSection() const

@ HiddenVisibility

The GV is hidden.

@ ExternalLinkage

Externally visible function.

StringRef getBufferIdentifier() const

StringRef getBuffer() const

static std::unique_ptr< MemoryBuffer > getMemBuffer(StringRef InputData, StringRef BufferName="", bool RequiresNullTerminator=true)

Open the specified memory range as a MemoryBuffer.

A Module instance is used to store all the information related to an LLVM module.

StringRef - Represent a constant reference to a string, i.e.

std::string str() const

str - Get the contents as an std::string.

bool starts_with(StringRef Prefix) const

Check if this string starts with the given Prefix.

StringRef drop_front(size_t N=1) const

Return a StringRef equal to 'this' but with the first N elements dropped.

Manages the enabling and disabling of subtarget specific features.

Target - Wrapper for Target specific information.

Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...

Value * getOperand(unsigned i) const

unsigned getNumOperands() const

LLVM Value Representation.

LLVM_ABI StringRef getName() const

Return a constant reference to the value's name.

std::pair< iterator, bool > insert(const ValueT &V)

size_type count(const_arg_type_t< ValueT > V) const

Return 1 if the specified key is in the set, 0 otherwise.

A range adaptor for a pair of iterators.

An Addressable with content and edges.

size_t getSize() const

Returns the size of this defined addressable.

Represents an object file section.

void setScope(Scope S)

Set the visibility for this Symbol.

void setName(const orc::SymbolStringPtr Name)

Rename this symbol.

void setLinkage(Linkage L)

Set the linkage for this Symbol.

static Expected< std::unique_ptr< Archive > > create(MemoryBufferRef Source)

This iterator provides a convenient way to iterate over the elements of an llvm.global_ctors/llvm....

LLVM_ABI bool operator!=(const CtorDtorIterator &Other) const

Test iterators for inequality.

Definition ExecutionUtils.cpp:40

LLVM_ABI Element operator*() const

Dereference iterator.

Definition ExecutionUtils.cpp:55

LLVM_ABI CtorDtorIterator(const GlobalVariable *GV, bool End)

Construct an iterator instance.

Definition ExecutionUtils.cpp:29

LLVM_ABI CtorDtorIterator & operator++()

Pre-increment iterator.

Definition ExecutionUtils.cpp:44

LLVM_ABI bool operator==(const CtorDtorIterator &Other) const

Test iterators for equality.

Definition ExecutionUtils.cpp:35

LLVM_ABI Error run()

Definition ExecutionUtils.cpp:143

LLVM_ABI void add(iterator_range< CtorDtorIterator > CtorDtors)

Definition ExecutionUtils.cpp:117

static std::unique_ptr< DLLImportDefinitionGenerator > Create(ExecutionSession &ES, ObjectLinkingLayer &L)

Creates a DLLImportDefinitionGenerator instance.

Definition ExecutionUtils.cpp:506

Error tryToGenerate(LookupState &LS, LookupKind K, JITDylib &JD, JITDylibLookupFlags JDLookupFlags, const SymbolLookupSet &Symbols) override

DefinitionGenerators should override this method to insert new definitions into the parent JITDylib.

Definition ExecutionUtils.cpp:512

friend class ExecutionSession

std::function< bool(const SymbolStringPtr &)> SymbolPredicate

unique_function< Error(JITDylib &, SymbolMap)> AddAbsoluteSymbolsFn

DynamicLibrarySearchGenerator(sys::DynamicLibrary Dylib, char GlobalPrefix, SymbolPredicate Allow=SymbolPredicate(), AddAbsoluteSymbolsFn AddAbsoluteSymbols=nullptr)

Create a DynamicLibrarySearchGenerator that searches for symbols in the given sys::DynamicLibrary.

Definition ExecutionUtils.cpp:221

static Expected< std::unique_ptr< DynamicLibrarySearchGenerator > > Load(const char *FileName, char GlobalPrefix, SymbolPredicate Allow=SymbolPredicate(), AddAbsoluteSymbolsFn AddAbsoluteSymbols=nullptr)

Permanently loads the library at the given path and, on success, returns a DynamicLibrarySearchGenera...

Definition ExecutionUtils.cpp:229

Error tryToGenerate(LookupState &LS, LookupKind K, JITDylib &JD, JITDylibLookupFlags JDLookupFlags, const SymbolLookupSet &Symbols) override

DefinitionGenerators should override this method to insert new definitions into the parent JITDylib.

Definition ExecutionUtils.cpp:241

const Triple & getTargetTriple() const

Return the triple for the executor.

std::shared_ptr< SymbolStringPool > getSymbolStringPool()

Get the SymbolStringPool for this instance.

static ExecutorAddr fromPtr(T *Ptr, UnwrapFn &&Unwrap=UnwrapFn())

Create an ExecutorAddr from the given pointer.

LLVM_ABI void runAtExits(void *DSOHandle)

Definition ExecutionUtils.cpp:203

LLVM_ABI void registerAtExit(void(*F)(void *), void *Ctx, void *DSOHandle)

Definition ExecutionUtils.cpp:197

Represents a JIT'd dynamic library.

Error define(std::unique_ptr< MaterializationUnitType > &&MU, ResourceTrackerSP RT=nullptr)

Define all symbols provided by the materialization unit to be part of this JITDylib.

auto withLinkOrderDo(Func &&F) -> decltype(F(std::declval< const JITDylibSearchOrder & >()))

Do something with the link order (run under the session lock).

void(*)(void *) DestructorPtr

static LLVM_ABI int CXAAtExitOverride(DestructorPtr Destructor, void *Arg, void *DSOHandle)

Definition ExecutionUtils.cpp:177

std::vector< CXXDestructorDataPair > CXXDestructorDataPairList

CXXDestructorDataPairList DSOHandleOverride

LLVM_ABI void runDestructors()

Run any destructors recorded by the overriden __cxa_atexit function (CXAAtExitOverride).

Definition ExecutionUtils.cpp:170

LLVM_ABI Error enable(JITDylib &JD, MangleAndInterner &Mangler)

Definition ExecutionUtils.cpp:186

Wraps state for a lookup-in-progress.

Mangles symbol names then uniques them in the context of an ExecutionSession.

Interface for Layers that accept object files.

An ObjectLayer implementation built on JITLink.

static VisitMembersFunction loadAllObjectFileMembers(ObjectLayer &L, JITDylib &JD)

A VisitMembersFunction that unconditionally loads all object files from the archive.

Definition ExecutionUtils.cpp:275

unique_function< Expected< MaterializationUnit::Interface >( ExecutionSession &ES, MemoryBufferRef ObjBuffer)> GetObjectFileInterface

Interface builder function for objects loaded from this archive.

unique_function< Expected< bool >( object::Archive &, MemoryBufferRef, size_t)> VisitMembersFunction

Callback for visiting archive members at construction time.

Error tryToGenerate(LookupState &LS, LookupKind K, JITDylib &JD, JITDylibLookupFlags JDLookupFlags, const SymbolLookupSet &Symbols) override

DefinitionGenerators should override this method to insert new definitions into the parent JITDylib.

Definition ExecutionUtils.cpp:416

static Expected< std::unique_ptr< StaticLibraryDefinitionGenerator > > Create(ObjectLayer &L, std::unique_ptr< MemoryBuffer > ArchiveBuffer, std::unique_ptr< object::Archive > Archive, VisitMembersFunction VisitMembers=VisitMembersFunction(), GetObjectFileInterface GetObjFileInterface=GetObjectFileInterface())

Try to create a StaticLibrarySearchGenerator from the given memory buffer and Archive object.

Definition ExecutionUtils.cpp:309

static Expected< std::unique_ptr< StaticLibraryDefinitionGenerator > > Load(ObjectLayer &L, const char *FileName, VisitMembersFunction VisitMembers=VisitMembersFunction(), GetObjectFileInterface GetObjFileInterface=GetObjectFileInterface())

Try to create a StaticLibraryDefinitionGenerator from the given path.

Definition ExecutionUtils.cpp:295

static std::unique_ptr< MemoryBuffer > createMemberBuffer(object::Archive &A, MemoryBufferRef BufRef, size_t Index)

Definition ExecutionUtils.cpp:483

A set of symbols to look up, each associated with a SymbolLookupFlags value.

SymbolLookupSet & add(SymbolStringPtr Name, SymbolLookupFlags Flags=SymbolLookupFlags::RequiredSymbol)

Add an element to the set.

bool containsDuplicates()

Returns true if this set contains any duplicates.

This class provides a portable interface to dynamic libraries which also might be known as shared lib...

static LLVM_ABI DynamicLibrary getPermanentLibrary(const char *filename, std::string *errMsg=nullptr)

This function permanently loads the dynamic library at the given path using the library load operatio...

static constexpr const StringLiteral & getSectionName(DebugSectionKind SectionKind)

Return the name of the section.

Symbol & createAnonymousPointer(LinkGraph &G, Section &PointerSection, Symbol *InitialTarget=nullptr, uint64_t InitialAddend=0)

Creates a new pointer block in the given section and returns an anonymous symbol pointing to it.

Block & createPointerJumpStubBlock(LinkGraph &G, Section &StubSection, Symbol &PointerSymbol)

Create a jump stub block that jumps via the pointer at the given symbol.

LLVM_ABI const char * getGenericEdgeKindName(Edge::Kind K)

Returns the string name of the given generic edge kind, or "unknown" otherwise.

LLVM_ABI Expected< std::unique_ptr< Binary > > createBinary(MemoryBufferRef Source, LLVMContext *Context=nullptr, bool InitContent=true)

Create a Binary from Source, autodetecting the file type.

JITDylibSearchOrder makeJITDylibSearchOrder(ArrayRef< JITDylib * > JDs, JITDylibLookupFlags Flags=JITDylibLookupFlags::MatchExportedSymbolsOnly)

Convenience function for creating a search order from an ArrayRef of JITDylib*, all with the same fla...

std::vector< std::pair< JITDylib *, JITDylibLookupFlags > > JITDylibSearchOrder

A list of (JITDylib*, JITDylibLookupFlags) pairs to be used as a search order during symbol lookup.

LLVM_ABI Expected< std::pair< std::unique_ptr< MemoryBuffer >, LinkableFileKind > > loadLinkableFile(StringRef Path, const Triple &TT, LoadArchives LA, std::optional< StringRef > IdentifierOverride=std::nullopt)

Create a MemoryBuffer covering the "linkable" part of the given path.

LLVM_ABI iterator_range< CtorDtorIterator > getDestructors(const Module &M)

Create an iterator range over the entries of the llvm.global_ctors array.

Definition ExecutionUtils.cpp:91

std::unique_ptr< AbsoluteSymbolsMaterializationUnit > absoluteSymbols(SymbolMap Symbols)

Create an AbsoluteSymbolsMaterializationUnit with the given symbols.

LLVM_ABI iterator_range< CtorDtorIterator > getConstructors(const Module &M)

Create an iterator range over the entries of the llvm.global_ctors array.

Definition ExecutionUtils.cpp:85

JITDylibLookupFlags

Lookup flags that apply to each dylib in the search order for a lookup.

DenseMap< SymbolStringPtr, ExecutorSymbolDef > SymbolMap

A map from symbol names (as SymbolStringPtrs) to JITSymbols (address/flags pairs).

LLVM_ABI Expected< MaterializationUnit::Interface > getObjectFileInterface(ExecutionSession &ES, MemoryBufferRef ObjBuffer)

Returns a MaterializationUnit::Interface for the object file contained in the given buffer,...

LLVM_ABI Expected< std::pair< size_t, size_t > > getMachOSliceRangeForTriple(object::MachOUniversalBinary &UB, const Triple &TT)

Utility for identifying the file-slice compatible with TT in a universal binary.

LookupKind

Describes the kind of lookup being performed.

@ Resolved

Queried, materialization begun.

This is an optimization pass for GlobalISel generic memory operations.

LLVM_ABI file_magic identify_magic(StringRef magic)

Identify the type of a binary file based on how magical it is.

auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)

Get the size of a range.

decltype(auto) dyn_cast(const From &Val)

dyn_cast - Return the argument parameter cast to the specified type.

LLVM_ABI std::error_code inconvertibleErrorCode()

The value returned by this function can be returned from convertToErrorCode for Error values where no...

iterator_range< T > make_range(T x, T y)

Convenience function for iterating over sub-ranges.

auto dyn_cast_or_null(const Y &Val)

bool isa(const From &Val)

isa - Return true if the parameter to the template is an instance of one of the template type argu...

Error make_error(ArgTs &&... Args)

Make a Error instance representing failure using the given error info type.

FunctionAddr VTableAddr uintptr_t uintptr_t Data

OutputIt move(R &&Range, OutputIt Out)

Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.

decltype(auto) cast(const From &Val)

cast - Return the argument parameter cast to the specified type.

void consumeError(Error Err)

Consume a Error without doing anything.

Implement std::hash so that hash_code can be used in STL containers.

@ elf_relocatable

ELF Relocatable object file.

@ macho_object

Mach-O Object file.

@ coff_object

COFF object file.

Accessor for an element of the global_ctors/global_dtors array.