LLVM 19.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/// Parses a build ID from a hex string.
34
35/// Returns the build ID, if any, contained in the given object file.
37
38/// BuildIDFetcher searches local cache directories for debug info.
40public:
41 BuildIDFetcher(std::vector<std::string> DebugFileDirectories)
42 : DebugFileDirectories(std::move(DebugFileDirectories)) {}
43 virtual ~BuildIDFetcher() = default;
44
45 /// Returns the path to the debug file with the given build ID.
46 virtual std::optional<std::string> fetch(BuildIDRef BuildID) const;
47
48private:
49 const std::vector<std::string> DebugFileDirectories;
50};
51
52} // namespace object
53} // namespace llvm
54
55#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:1209
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
BuildIDFetcher searches local cache directories for debug info.
Definition: BuildID.h:39
BuildIDFetcher(std::vector< std::string > DebugFileDirectories)
Definition: BuildID.h:41
virtual std::optional< std::string > fetch(BuildIDRef BuildID) const
Returns the path to the debug file with the given build ID.
Definition: BuildID.cpp:68
virtual ~BuildIDFetcher()=default
This class is the base class for all object file types.
Definition: ObjectFile.h:229
SmallVector< uint8_t, 10 > BuildID
A build ID in binary form.
Definition: BuildID.h:25
BuildIDRef getBuildID(const ObjectFile *Obj)
Returns the build ID, if any, contained in the given object file.
Definition: BuildID.cpp:56
BuildID parseBuildID(StringRef Str)
Parses a build ID from a hex string.
Definition: BuildID.cpp:47
ArrayRef< uint8_t > BuildIDRef
A reference to a BuildID in binary form.
Definition: BuildID.h:28
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:1858
Implement std::hash so that hash_code can be used in STL containers.
Definition: BitVector.h:858