BuildID.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- llvm/Object/BuildID.h - Build ID -------------------------*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. ///
  14. /// \file
  15. /// This file declares a library for handling Build IDs and using them to find
  16. /// debug info.
  17. ///
  18. //===----------------------------------------------------------------------===//
  19. #ifndef LLVM_DEBUGINFO_OBJECT_BUILDID_H
  20. #define LLVM_DEBUGINFO_OBJECT_BUILDID_H
  21. #include "llvm/ADT/ArrayRef.h"
  22. #include "llvm/ADT/SmallVector.h"
  23. namespace llvm {
  24. namespace object {
  25. /// A build ID in binary form.
  26. typedef SmallVector<uint8_t, 10> BuildID;
  27. /// A reference to a BuildID in binary form.
  28. typedef ArrayRef<uint8_t> BuildIDRef;
  29. class ObjectFile;
  30. /// Returns the build ID, if any, contained in the given object file.
  31. std::optional<BuildIDRef> getBuildID(const ObjectFile *Obj);
  32. /// BuildIDFetcher searches local cache directories for debug info.
  33. class BuildIDFetcher {
  34. public:
  35. BuildIDFetcher(std::vector<std::string> DebugFileDirectories)
  36. : DebugFileDirectories(std::move(DebugFileDirectories)) {}
  37. virtual ~BuildIDFetcher() = default;
  38. /// Returns the path to the debug file with the given build ID.
  39. virtual std::optional<std::string> fetch(BuildIDRef BuildID) const;
  40. private:
  41. const std::vector<std::string> DebugFileDirectories;
  42. };
  43. } // namespace object
  44. } // namespace llvm
  45. #endif // LLVM_DEBUGINFO_OBJECT_BUILDID_H
  46. #ifdef __GNUC__
  47. #pragma GCC diagnostic pop
  48. #endif