DWARFLocationExpression.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- DWARFLocationExpression.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_DWARF_DWARFLOCATIONEXPRESSION_H
  14. #define LLVM_DEBUGINFO_DWARF_DWARFLOCATIONEXPRESSION_H
  15. #include "llvm/ADT/Optional.h"
  16. #include "llvm/DebugInfo/DWARF/DWARFAddressRange.h"
  17. namespace llvm {
  18. class raw_ostream;
  19. /// Represents a single DWARF expression, whose value is location-dependent.
  20. /// Typically used in DW_AT_location attributes to describe the location of
  21. /// objects.
  22. struct DWARFLocationExpression {
  23. /// The address range in which this expression is valid. None denotes a
  24. /// default entry which is valid in addresses not covered by other location
  25. /// expressions, or everywhere if there are no other expressions.
  26. Optional<DWARFAddressRange> Range;
  27. /// The expression itself.
  28. SmallVector<uint8_t, 4> Expr;
  29. };
  30. inline bool operator==(const DWARFLocationExpression &L,
  31. const DWARFLocationExpression &R) {
  32. return L.Range == R.Range && L.Expr == R.Expr;
  33. }
  34. inline bool operator!=(const DWARFLocationExpression &L,
  35. const DWARFLocationExpression &R) {
  36. return !(L == R);
  37. }
  38. raw_ostream &operator<<(raw_ostream &OS, const DWARFLocationExpression &Loc);
  39. /// Represents a set of absolute location expressions.
  40. using DWARFLocationExpressionsVector = std::vector<DWARFLocationExpression>;
  41. } // end namespace llvm
  42. #endif // LLVM_DEBUGINFO_DWARF_DWARFLOCATIONEXPRESSION_H
  43. #ifdef __GNUC__
  44. #pragma GCC diagnostic pop
  45. #endif