DWARFAttribute.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- DWARFAttribute.h -----------------------------------------*- 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. #ifndef LLVM_DEBUGINFO_DWARFATTRIBUTE_H
  14. #define LLVM_DEBUGINFO_DWARFATTRIBUTE_H
  15. #include "llvm/BinaryFormat/Dwarf.h"
  16. #include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
  17. #include <cstdint>
  18. namespace llvm {
  19. //===----------------------------------------------------------------------===//
  20. /// Encapsulates a DWARF attribute value and all of the data required to
  21. /// describe the attribute value.
  22. ///
  23. /// This class is designed to be used by clients that want to iterate across all
  24. /// attributes in a DWARFDie.
  25. struct DWARFAttribute {
  26. /// The debug info/types offset for this attribute.
  27. uint64_t Offset = 0;
  28. /// The debug info/types section byte size of the data for this attribute.
  29. uint32_t ByteSize = 0;
  30. /// The attribute enumeration of this attribute.
  31. dwarf::Attribute Attr = dwarf::Attribute(0);
  32. /// The form and value for this attribute.
  33. DWARFFormValue Value;
  34. bool isValid() const {
  35. return Offset != 0 && Attr != dwarf::Attribute(0);
  36. }
  37. explicit operator bool() const {
  38. return isValid();
  39. }
  40. /// Identifies DWARF attributes that may contain a reference to a
  41. /// DWARF expression.
  42. static bool mayHaveLocationDescription(dwarf::Attribute Attr);
  43. };
  44. } // end namespace llvm
  45. #endif // LLVM_DEBUGINFO_DWARFATTRIBUTE_H
  46. #ifdef __GNUC__
  47. #pragma GCC diagnostic pop
  48. #endif