DWARFLocationExpression.h 1.8 KB

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