1 //===- llvm/Object/BuildID.h - Build ID -------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
10 /// This file declares a library for handling Build IDs and using them to find
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_DEBUGINFO_OBJECT_BUILDID_H
16 #define LLVM_DEBUGINFO_OBJECT_BUILDID_H
18 #include "llvm/ADT/ArrayRef.h"
19 #include "llvm/ADT/SmallVector.h"
24 /// A build ID in binary form.
25 typedef SmallVector<uint8_t, 10> BuildID;
27 /// A reference to a BuildID in binary form.
28 typedef ArrayRef<uint8_t> BuildIDRef;
32 /// Parses a build ID from a hex string.
33 BuildID parseBuildID(StringRef Str);
35 /// Returns the build ID, if any, contained in the given object file.
36 BuildIDRef getBuildID(const ObjectFile *Obj);
38 /// BuildIDFetcher searches local cache directories for debug info.
39 class BuildIDFetcher {
41 BuildIDFetcher(std::vector<std::string> DebugFileDirectories)
42 : DebugFileDirectories(std::move(DebugFileDirectories)) {}
43 virtual ~BuildIDFetcher() = default;
45 /// Returns the path to the debug file with the given build ID.
46 virtual std::optional<std::string> fetch(BuildIDRef BuildID) const;
49 const std::vector<std::string> DebugFileDirectories;
55 #endif // LLVM_DEBUGINFO_OBJECT_BUILDID_H