LLVM 17.0.0git
BuildID.h
Go to the documentation of this file.
1//===- llvm/Object/BuildID.h - Build ID -------------------------*- 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/// \file
10/// This file declares a library for handling Build IDs and using them to find
11/// debug info.
12///
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_DEBUGINFO_OBJECT_BUILDID_H
16#define LLVM_DEBUGINFO_OBJECT_BUILDID_H
17
18#include "llvm/ADT/ArrayRef.h"
20
21namespace llvm {
22namespace object {
23
24/// A build ID in binary form.
26
27/// A reference to a BuildID in binary form.
29
30class ObjectFile;
31
32/// Returns the build ID, if any, contained in the given object file.
33std::optional<BuildIDRef> getBuildID(const ObjectFile *Obj);
34
35/// BuildIDFetcher searches local cache directories for debug info.
37public:
38 BuildIDFetcher(std::vector<std::string> DebugFileDirectories)
39 : DebugFileDirectories(std::move(DebugFileDirectories)) {}
40 virtual ~BuildIDFetcher() = default;
41
42 /// Returns the path to the debug file with the given build ID.
43 virtual std::optional<std::string> fetch(BuildIDRef BuildID) const;
44
45private:
46 const std::vector<std::string> DebugFileDirectories;
47};
48
49} // namespace object
50} // namespace llvm
51
52#endif // LLVM_DEBUGINFO_OBJECT_BUILDID_H
This file defines the SmallVector class.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1200
BuildIDFetcher searches local cache directories for debug info.
Definition: BuildID.h:36
BuildIDFetcher(std::vector< std::string > DebugFileDirectories)
Definition: BuildID.h:38
virtual ~BuildIDFetcher()=default
virtual std::optional< std::string > fetch(BuildIDRef BuildID) const
Returns the path to the debug file with the given build ID.
Definition: BuildID.cpp:60
This class is the base class for all object file types.
Definition: ObjectFile.h:228
SmallVector< uint8_t, 10 > BuildID
A build ID in binary form.
Definition: BuildID.h:25
ArrayRef< uint8_t > BuildIDRef
A reference to a BuildID in binary form.
Definition: BuildID.h:28
std::optional< BuildIDRef > getBuildID(const ObjectFile *Obj)
Returns the build ID, if any, contained in the given object file.
Definition: BuildID.cpp:48
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1862
Definition: BitVector.h:851