LLVM: lib/DebugInfo/Symbolize/Symbolize.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

14

36#include

37#include

38

39namespace llvm {

42}

44

46

48 : Opts(Opts),

49 BIDFetcher(std::make_unique<BuildIDFetcher>(Opts.DebugFileDirectory)) {}

50

52

53template

55LLVMSymbolizer::symbolizeCodeCommon(const T &ModuleSpecifier,

57

59 if (!InfoOrErr)

60 return InfoOrErr.takeError();

61

63

64

65

68

69

70

72 ModuleOffset.Address += Info->getModulePreferredBase();

73

75 ModuleOffset,

80 LineInfo.FunctionName = DemangleName(LineInfo.FunctionName, Info);

81 return LineInfo;

82}

83

87 return symbolizeCodeCommon(Obj, ModuleOffset);

88}

89

93 return symbolizeCodeCommon(ModuleName, ModuleOffset);

94}

95

99 return symbolizeCodeCommon(BuildID, ModuleOffset);

100}

101

102template

106 if (!InfoOrErr)

107 return InfoOrErr.takeError();

108

110

111

112

115

116

117

119 ModuleOffset.Address += Info->getModulePreferredBase();

120

122 ModuleOffset,

127 for (int i = 0, n = InlinedContext.getNumberOfFrames(); i < n; i++) {

129 Frame->FunctionName = DemangleName(Frame->FunctionName, Info);

130 }

131 }

133}

134

135Expected

138 return symbolizeInlinedCodeCommon(Obj, ModuleOffset);

139}

140

144 return symbolizeInlinedCodeCommon(ModuleName, ModuleOffset);

145}

146

150 return symbolizeInlinedCodeCommon(BuildID, ModuleOffset);

151}

152

153template

155LLVMSymbolizer::symbolizeDataCommon(const T &ModuleSpecifier,

157

159 if (!InfoOrErr)

160 return InfoOrErr.takeError();

161

163

164

167

168

169

170

172 ModuleOffset.Address += Info->getModulePreferredBase();

173

178}

179

183 return symbolizeDataCommon(Obj, ModuleOffset);

184}

185

189 return symbolizeDataCommon(ModuleName, ModuleOffset);

190}

191

195 return symbolizeDataCommon(BuildID, ModuleOffset);

196}

197

198template

200LLVMSymbolizer::symbolizeFrameCommon(const T &ModuleSpecifier,

203 if (!InfoOrErr)

204 return InfoOrErr.takeError();

205

207

208

210 return std::vector();

211

212

213

214

216 ModuleOffset.Address += Info->getModulePreferredBase();

217

218 return Info->symbolizeFrame(ModuleOffset);

219}

220

224 return symbolizeFrameCommon(Obj, ModuleOffset);

225}

226

230 return symbolizeFrameCommon(ModuleName, ModuleOffset);

231}

232

236 return symbolizeFrameCommon(BuildID, ModuleOffset);

237}

238

239template

241LLVMSymbolizer::findSymbolCommon(const T &ModuleSpecifier, StringRef Symbol,

244 if (!InfoOrErr)

245 return InfoOrErr.takeError();

246

248 std::vector Result;

249

250

251

253 return Result;

254

261 LineInfo.FunctionName = DemangleName(LineInfo.FunctionName, Info);

262 Result.push_back(std::move(LineInfo));

263 }

264 }

265

266 return Result;

267}

268

269Expected<std::vector>

272 return findSymbolCommon(Obj, Symbol, Offset);

273}

274

280

286

288 ObjectForUBPathAndArch.clear();

289 LRUBinaries.clear();

290 CacheSize = 0;

291 BinaryForPath.clear();

292 ObjectPairForPathArch.clear();

293 Modules.clear();

294 BuildIDPaths.clear();

295}

296

297namespace {

298

299

300

301

302

303std::string getDarwinDWARFResourceForPath(const std::string &Path,

304 const std::string &Basename) {

307 ResourceName += ".dSYM";

308 }

309 sys::path::append(ResourceName, "Contents", "Resources", "DWARF");

311 return std::string(ResourceName);

312}

313

314bool checkFileCRC(StringRef Path, uint32_t CRCHash) {

315 ErrorOr<std::unique_ptr> MB =

317 if (!MB)

318 return false;

320}

321

322bool getGNUDebuglinkContents(const ObjectFile *Obj, std::string &DebugName,

323 uint32_t &CRCHash) {

324 if (!Obj)

325 return false;

326 for (const SectionRef &Section : Obj->sections()) {

327 StringRef Name;

329

330 Name = Name.substr(Name.find_first_not_of("._"));

331 if (Name == "gnu_debuglink") {

332 Expected ContentsOrErr = Section.getContents();

333 if (!ContentsOrErr) {

335 return false;

336 }

337 DataExtractor DE(*ContentsOrErr, Obj->isLittleEndian(), 0);

339 if (const char *DebugNameStr = DE.getCStr(&Offset)) {

340

342 if (DE.isValidOffsetForDataOfSize(Offset, 4)) {

343 DebugName = DebugNameStr;

344 CRCHash = DE.getU32(&Offset);

345 return true;

346 }

347 }

348 break;

349 }

350 }

351 return false;

352}

353

354bool darwinDsymMatchesBinary(const MachOObjectFile *DbgObj,

356 ArrayRef<uint8_t> dbg_uuid = DbgObj->getUuid();

357 ArrayRef<uint8_t> bin_uuid = Obj->getUuid();

358 if (dbg_uuid.empty() || bin_uuid.empty())

359 return false;

360 return memcmp(dbg_uuid.data(), bin_uuid.data(), dbg_uuid.size());

361}

362

363}

364

365ObjectFile *LLVMSymbolizer::lookUpDsymFile(const std::string &ExePath,

367 const std::string &ArchName) {

368

369

370 std::vectorstd::string DsymPaths;

372 DsymPaths.push_back(

373 getDarwinDWARFResourceForPath(ExePath, std::string(Filename)));

374 for (const auto &Path : Opts.DsymHints) {

375 DsymPaths.push_back(

376 getDarwinDWARFResourceForPath(Path, std::string(Filename)));

377 }

378 for (const auto &Path : DsymPaths) {

379 auto DbgObjOrErr = getOrCreateObject(Path, ArchName);

380 if (!DbgObjOrErr) {

381

383 continue;

384 }

385 ObjectFile *DbgObj = DbgObjOrErr.get();

386 if (!DbgObj)

387 continue;

389 if (!MachDbgObj)

390 continue;

391 if (darwinDsymMatchesBinary(MachDbgObj, MachExeObj))

392 return DbgObj;

393 }

394 return nullptr;

395}

396

397ObjectFile *LLVMSymbolizer::lookUpDebuglinkObject(const std::string &Path,

399 const std::string &ArchName) {

400 std::string DebuglinkName;

401 uint32_t CRCHash;

402 std::string DebugBinaryPath;

403 if (!getGNUDebuglinkContents(Obj, DebuglinkName, CRCHash))

404 return nullptr;

405 if (!findDebugBinary(Path, DebuglinkName, CRCHash, DebugBinaryPath))

406 return nullptr;

407 auto DbgObjOrErr = getOrCreateObject(DebugBinaryPath, ArchName);

408 if (!DbgObjOrErr) {

409

411 return nullptr;

412 }

413 return DbgObjOrErr.get();

414}

415

416ObjectFile *LLVMSymbolizer::lookUpBuildIDObject(const std::string &Path,

418 const std::string &ArchName) {

421 return nullptr;

422 std::string DebugBinaryPath;

423 if (!getOrFindDebugBinary(BuildID, DebugBinaryPath))

424 return nullptr;

425 auto DbgObjOrErr = getOrCreateObject(DebugBinaryPath, ArchName);

426 if (!DbgObjOrErr) {

428 return nullptr;

429 }

430 return DbgObjOrErr.get();

431}

432

433bool LLVMSymbolizer::findDebugBinary(const std::string &OrigPath,

434 const std::string &DebuglinkName,

435 uint32_t CRCHash, std::string &Result) {

436 SmallString<16> OrigDir(OrigPath);

438 SmallString<16> DebugPath = OrigDir;

439

441 if (checkFileCRC(DebugPath, CRCHash)) {

442 Result = std::string(DebugPath);

443 return true;

444 }

445

446 DebugPath = OrigDir;

448 if (checkFileCRC(DebugPath, CRCHash)) {

449 Result = std::string(DebugPath);

450 return true;

451 }

452

453

454

456 if (!Opts.FallbackDebugPath.empty()) {

457

458 DebugPath = Opts.FallbackDebugPath;

459 } else {

460#if defined(__NetBSD__)

461

462 DebugPath = "/usr/libdata/debug";

463#else

464

465 DebugPath = "/usr/lib/debug";

466#endif

467 }

469 DebuglinkName);

470 if (checkFileCRC(DebugPath, CRCHash)) {

471 Result = std::string(DebugPath);

472 return true;

473 }

474 return false;

475}

476

481

483 std::string &Result) {

485 auto I = BuildIDPaths.find(BuildIDStr);

486 if (I != BuildIDPaths.end()) {

487 Result = I->second;

488 return true;

489 }

490 if (!BIDFetcher)

491 return false;

492 if (std::optionalstd::string Path = BIDFetcher->fetch(BuildID)) {

493 Result = *Path;

494 auto InsertResult = BuildIDPaths.insert({BuildIDStr, Result});

495 assert(InsertResult.second);

496 (void)InsertResult;

497 return true;

498 }

499

500 return false;

501}

502

503std::string LLVMSymbolizer::lookUpGsymFile(const std::string &Path) {

504 if (Opts.DisableGsym)

505 return {};

506

507 auto CheckGsymFile = [](const llvm::StringRef &GsymPath) {

508 sys::fs::file_status Status;

511 };

512

513

514 if (const auto GsymPath = Path + ".gsym"; CheckGsymFile(GsymPath))

515 return GsymPath;

516

517

518

519 for (const auto &Directory : Opts.GsymFileDirectory) {

520 SmallString<16> GsymPath = llvm::StringRef{Directory};

523

524 if (CheckGsymFile(GsymPath))

525 return static_caststd::string\(GsymPath);

526 }

527

528 return {};

529}

530

531ExpectedLLVMSymbolizer::ObjectPair

532LLVMSymbolizer::getOrCreateObjectPair(const std::string &Path,

533 const std::string &ArchName) {

534 auto I = ObjectPairForPathArch.find(std::make_pair(Path, ArchName));

535 if (I != ObjectPairForPathArch.end()) {

536 recordAccess(BinaryForPath.find(Path)->second);

537 return I->second;

538 }

539

540 auto ObjOrErr = getOrCreateObject(Path, ArchName);

541 if (!ObjOrErr) {

542 ObjectPairForPathArch.emplace(std::make_pair(Path, ArchName),

543 ObjectPair(nullptr, nullptr));

544 return ObjOrErr.takeError();

545 }

546

548 assert(Obj != nullptr);

550

552 DbgObj = lookUpDsymFile(Path, MachObj, ArchName);

554 DbgObj = lookUpBuildIDObject(Path, ELFObj, ArchName);

555 if (!DbgObj)

556 DbgObj = lookUpDebuglinkObject(Path, Obj, ArchName);

557 if (!DbgObj)

558 DbgObj = Obj;

559 ObjectPair Res = std::make_pair(Obj, DbgObj);

560 std::string DbgObjPath = DbgObj->getFileName().str();

561 auto Pair =

562 ObjectPairForPathArch.emplace(std::make_pair(Path, ArchName), Res);

563 BinaryForPath.find(DbgObjPath)->second.pushEvictor([this, I = Pair.first]() {

564 ObjectPairForPathArch.erase(I);

565 });

566 return Res;

567}

568

569Expected<ObjectFile *>

570LLVMSymbolizer::getOrCreateObject(const std::string &Path,

571 const std::string &ArchName) {

573 auto Pair = BinaryForPath.emplace(Path, OwningBinary());

574 if (!Pair.second) {

575 Bin = Pair.first->second->getBinary();

576 recordAccess(Pair.first->second);

577 } else {

578 Expected<OwningBinary> BinOrErr = createBinary(Path);

579 if (!BinOrErr)

580 return BinOrErr.takeError();

581

582 CachedBinary &CachedBin = Pair.first->second;

583 CachedBin = std::move(BinOrErr.get());

584 CachedBin.pushEvictor([this, I = Pair.first]() { BinaryForPath.erase(I); });

585 LRUBinaries.push_back(CachedBin);

586 CacheSize += CachedBin.size();

587 Bin = CachedBin->getBinary();

588 }

589

590 if (Bin)

591 return static_cast<ObjectFile *>(nullptr);

592

594 auto I = ObjectForUBPathAndArch.find(std::make_pair(Path, ArchName));

595 if (I != ObjectForUBPathAndArch.end())

596 return I->second.get();

597

598 Expected<std::unique_ptr> ObjOrErr =

599 UB->getMachOObjectForArch(ArchName);

600 if (!ObjOrErr) {

601 ObjectForUBPathAndArch.emplace(std::make_pair(Path, ArchName),

602 std::unique_ptr());

603 return ObjOrErr.takeError();

604 }

606 auto Pair = ObjectForUBPathAndArch.emplace(std::make_pair(Path, ArchName),

607 std::move(ObjOrErr.get()));

608 BinaryForPath.find(Path)->second.pushEvictor(

609 [this, Iter = Pair.first]() { ObjectForUBPathAndArch.erase(Iter); });

610 return Res;

611 }

612 if (Bin->isObject()) {

614 }

616}

617

618Expected<SymbolizableModule *>

619LLVMSymbolizer::createModuleInfo(const ObjectFile *Obj,

620 std::unique_ptr Context,

621 StringRef ModuleName) {

623 Opts.UntagAddresses);

624 std::unique_ptr SymMod;

625 if (InfoOrErr)

626 SymMod = std::move(*InfoOrErr);

627 auto InsertResult = Modules.insert(

628 std::make_pair(std::string(ModuleName), std::move(SymMod)));

629 assert(InsertResult.second);

630 if (!InfoOrErr)

631 return InfoOrErr.takeError();

632 return InsertResult.first->second.get();

633}

634

635Expected<SymbolizableModule *>

638 StringRef ArchName = Opts.DefaultArch;

639 size_t ColonPos = ModuleName.find_last_of(':');

640

641 if (ColonPos != std:🧵:npos) {

644 BinaryName = ModuleName.substr(0, ColonPos);

645 ArchName = ArchStr;

646 }

647 }

648

650 if (I != Modules.end()) {

651 recordAccess(BinaryForPath.find(BinaryName)->second);

652 return I->second.get();

653 }

654

655 auto ObjectsOrErr =

656 getOrCreateObjectPair(std::string{BinaryName}, std::string{ArchName});

657 if (!ObjectsOrErr) {

658

659 Modules.emplace(ModuleName, std::unique_ptr());

660 return ObjectsOrErr.takeError();

661 }

662 ObjectPair Objects = ObjectsOrErr.get();

663

664 std::unique_ptr Context;

665

666

667

668

669

670

671

672 const auto GsymFile = lookUpGsymFile(BinaryName.str());

673 if (!GsymFile.empty()) {

675

676 if (ReaderOrErr) {

677 std::unique_ptrgsym::GsymReader Reader =

678 std::make_uniquegsym::GsymReader(std::move(*ReaderOrErr));

679

680 Context = std::make_uniquegsym::GsymContext(std::move(Reader));

681 }

682 }

683 if (!Context) {

687 auto EC = CoffObject->getDebugPDBInfo(DebugInfo, PDBFileName);

688

690 Objects.first->sections(), [](SectionRef Section) -> bool {

691 if (Expected SectionName = Section.getName())

692 return SectionName.get() == ".debug_info";

693 return false;

694 });

695 if (!EC && !HasDwarf && DebugInfo != nullptr && !PDBFileName.empty()) {

696 using namespace pdb;

697 std::unique_ptr Session;

698

699 PDB_ReaderType ReaderType =

700 Opts.UseDIA ? PDB_ReaderType::DIA : PDB_ReaderType::Native;

701 if (auto Err = loadDataForEXE(ReaderType, Objects.first->getFileName(),

702 Session)) {

703 Modules.emplace(ModuleName, std::unique_ptr());

704

706 }

707 Context.reset(new PDBContext(*CoffObject, std::move(Session)));

708 }

709 }

710 }

711 if (!Context)

714 nullptr, Opts.DWPName);

715 auto ModuleOrErr =

716 createModuleInfo(Objects.first, std::move(Context), ModuleName);

717 if (ModuleOrErr) {

719 BinaryForPath.find(BinaryName)->second.pushEvictor([this, I]() {

720 Modules.erase(I);

721 });

722 }

723 return ModuleOrErr;

724}

725

726

727

729 return Obj.makeTriple().isBPF() && !Obj.hasDebugInfo() &&

731}

732

735 StringRef ObjName = Obj.getFileName();

736 auto I = Modules.find(ObjName);

737 if (I != Modules.end())

738 return I->second.get();

739

740 std::unique_ptr Context;

743 else

745

746 return createModuleInfo(&Obj, std::move(Context), ObjName);

747}

748

749Expected<SymbolizableModule *>

751 std::string Path;

752 if (!getOrFindDebugBinary(BuildID, Path)) {

754 "could not find build ID");

755 }

757}

758

759namespace {

760

761

762

763

764

765

766

767StringRef demanglePE32ExternCFunc(StringRef SymbolName) {

769

770

771 bool HasAtNumSuffix = false;

772 if (Front != '?') {

773 size_t AtPos = SymbolName.rfind('@');

777 HasAtNumSuffix = true;

778 }

779 }

780

781

782 bool IsVectorCall = false;

783 if (HasAtNumSuffix && SymbolName.ends_with("@")) {

785 IsVectorCall = true;

786 }

787

788

789 if (!IsVectorCall && (Front == '_' || Front == '@'))

791

793}

794

795}

796

797std::string

800 std::string Result;

802 return Result;

803

804 if (Name.starts_with('?')) {

805

806 int status = 0;

808 Name, nullptr, &status,

811 if (status != 0)

812 return std::string{Name};

813 Result = DemangledName;

814 free(DemangledName);

815 return Result;

816 }

817

818 if (DbiModuleDescriptor && DbiModuleDescriptor->isWin32Module()) {

819 std::string DemangledCName(demanglePE32ExternCFunc(Name));

820

821

823 return Result;

824 return DemangledCName;

825 }

826 return std::string{Name};

827}

828

830 if (Bin->getBinary())

831 LRUBinaries.splice(LRUBinaries.end(), LRUBinaries, Bin.getIterator());

832}

833

835

836

837

838 while (CacheSize > Opts.MaxCacheSize && !LRUBinaries.empty() &&

839 std::next(LRUBinaries.begin()) != LRUBinaries.end()) {

841 CacheSize -= Bin.size();

842 LRUBinaries.pop_front();

843 Bin.evict();

844 }

845}

846

848 if (Evictor) {

849 this->Evictor = [OldEvictor = std::move(this->Evictor),

850 NewEvictor = std::move(NewEvictor)]() {

851 NewEvictor();

852 OldEvictor();

853 };

854 } else {

855 this->Evictor = std::move(NewEvictor);

856 }

857}

858

859}

860}

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

This file declares a library for handling Build IDs and using them to find debug info.

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

Analysis containing CSE Info

Merge contiguous icmps into a memcmp

ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...

static std::unique_ptr< BTFContext > create(const object::ObjectFile &Obj, std::function< void(Error)> ErrorHandler=WithColor::defaultErrorHandler)

static LLVM_ABI bool hasBTFSections(const ObjectFile &Obj)

A format-neutral container for inlined code description.

static std::unique_ptr< DWARFContext > create(const object::ObjectFile &Obj, ProcessDebugRelocations RelocAction=ProcessDebugRelocations::Process, const LoadedObjectInfo *L=nullptr, std::string DWPName="", std::function< void(Error)> RecoverableErrorHandler=WithColor::defaultErrorHandler, std::function< void(Error)> WarningHandler=WithColor::defaultWarningHandler, bool ThreadSafe=false)

Tagged union holding either a T or a Error.

static ErrorOr< std::unique_ptr< MemoryBuffer > > getFileOrSTDIN(const Twine &Filename, bool IsText=false, bool RequiresNullTerminator=true, std::optional< Align > Alignment=std::nullopt)

Open the specified file as a MemoryBuffer, or open stdin if the Filename is "-".

SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...

iterator find(StringRef Key)

bool insert(MapEntryTy *KeyValue)

insert - Insert the specified key/value pair into the map.

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

static constexpr size_t npos

std::string str() const

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

constexpr bool empty() const

empty - Check if the string is empty.

Triple - Helper class for working with autoconf configuration names.

static LLVM_ABI llvm::Expected< GsymReader > openFile(StringRef Path)

Construct a GsymReader from a file on disk.

BuildIDFetcher searches local cache directories for debug info.

This class is the base class for all object file types.

This is a value type class that represents a single section in the list of sections in the object fil...

LLVM_ABI void pushEvictor(std::function< void()> Evictor)

Definition Symbolize.cpp:847

static LLVM_ABI std::string DemangleName(StringRef Name, const SymbolizableModule *DbiModuleDescriptor)

Definition Symbolize.cpp:798

LLVM_ABI void pruneCache()

Definition Symbolize.cpp:834

LLVM_ABI Expected< std::vector< DILineInfo > > findSymbol(const ObjectFile &Obj, StringRef Symbol, uint64_t Offset)

Definition Symbolize.cpp:270

LLVM_ABI Expected< DIInliningInfo > symbolizeInlinedCode(const ObjectFile &Obj, object::SectionedAddress ModuleOffset)

Definition Symbolize.cpp:136

LLVM_ABI LLVMSymbolizer()

LLVM_ABI Expected< DILineInfo > symbolizeCode(const ObjectFile &Obj, object::SectionedAddress ModuleOffset)

Definition Symbolize.cpp:85

LLVM_ABI void flush()

Definition Symbolize.cpp:287

LLVM_ABI Expected< DIGlobal > symbolizeData(const ObjectFile &Obj, object::SectionedAddress ModuleOffset)

Definition Symbolize.cpp:181

LLVM_ABI Expected< std::vector< DILocal > > symbolizeFrame(const ObjectFile &Obj, object::SectionedAddress ModuleOffset)

Definition Symbolize.cpp:222

LLVM_ABI Expected< SymbolizableModule * > getOrCreateModuleInfo(StringRef ModuleName)

Returns a SymbolizableModule or an error if loading debug info failed.

Definition Symbolize.cpp:636

LLVM_ABI ~LLVMSymbolizer()

virtual bool isWin32Module() const =0

static Expected< std::unique_ptr< SymbolizableObjectFile > > create(const object::ObjectFile *Obj, std::unique_ptr< DIContext > DICtx, bool UntagAddresses)

constexpr char SymbolName[]

Key for Kernel::Metadata::mSymbolName.

SmallVector< uint8_t, 10 > BuildID

A build ID in binary form.

LLVM_ABI BuildIDRef getBuildID(const ObjectFile *Obj)

Returns the build ID, if any, contained in the given object file.

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.

static bool useBTFContext(const ObjectFile &Obj)

Definition Symbolize.cpp:728

static StringRef getBuildIDStr(ArrayRef< uint8_t > BuildID)

Definition Symbolize.cpp:477

LLVM_ABI std::error_code make_absolute(SmallVectorImpl< char > &path)

Make path an absolute path.

LLVM_ABI std::error_code status(const Twine &path, file_status &result, bool follow=true)

Get file status as if by POSIX stat().

LLVM_ABI bool is_directory(const basic_file_status &status)

Does status represent a directory?

LLVM_ABI void remove_filename(SmallVectorImpl< char > &path, Style style=Style::native)

Remove the last component from path unless it is the root dir.

LLVM_ABI StringRef filename(StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)

Get filename.

LLVM_ABI void append(SmallVectorImpl< char > &path, const Twine &a, const Twine &b="", const Twine &c="", const Twine &d="")

Append to path.

LLVM_ABI StringRef extension(StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)

Get extension.

LLVM_ABI StringRef relative_path(StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)

Get relative path.

This is an optimization pass for GlobalISel generic memory operations.

auto drop_begin(T &&RangeOrContainer, size_t N=1)

Return a range covering RangeOrContainer with the first N elements excluded.

DEMANGLE_ABI bool nonMicrosoftDemangle(std::string_view MangledName, std::string &Result, bool CanHaveLeadingDot=true, bool ParseParams=true)

bool all_of(R &&range, UnaryPredicate P)

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

Error createFileError(const Twine &F, Error E)

Concatenate a source file path and/or name with an Error.

ArrayRef< CharT > arrayRefFromStringRef(StringRef Input)

Construct a string ref from an array ref of unsigned chars.

decltype(auto) dyn_cast(const From &Val)

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

Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)

Create formatted StringError object.

@ no_such_file_or_directory

auto dyn_cast_or_null(const Y &Val)

bool any_of(R &&range, UnaryPredicate P)

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

bool isDigit(char C)

Checks if character C is one of the 10 decimal digits.

@ Global

Append to llvm.global_dtors.

LLVM_ABI uint32_t crc32(ArrayRef< uint8_t > Data)

DEMANGLE_ABI char * microsoftDemangle(std::string_view mangled_name, size_t *n_read, int *status, MSDemangleFlags Flags=MSDF_None)

Demangles the Microsoft symbol pointed at by mangled_name and returns it.

@ MSDF_NoCallingConvention

decltype(auto) cast(const From &Val)

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

LLVM_ABI Error errorCodeToError(std::error_code EC)

Helper for converting an std::error_code to a Error.

void consumeError(Error Err)

Consume a Error without doing anything.

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

Container for description of a global variable.

Controls which fields of DILineInfo container should be filled with data.

A format-neutral container for source line information.

static constexpr const char *const BadString

FunctionNameKind PrintFunctions

FileLineInfoKind PathStyle