Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:43:41

0001 //===- DWARFLocationExpression.h --------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLVM_DEBUGINFO_DWARF_DWARFLOCATIONEXPRESSION_H
0010 #define LLVM_DEBUGINFO_DWARF_DWARFLOCATIONEXPRESSION_H
0011 
0012 #include "llvm/DebugInfo/DWARF/DWARFAddressRange.h"
0013 
0014 namespace llvm {
0015 
0016 class raw_ostream;
0017 
0018 /// Represents a single DWARF expression, whose value is location-dependent.
0019 /// Typically used in DW_AT_location attributes to describe the location of
0020 /// objects.
0021 struct DWARFLocationExpression {
0022   /// The address range in which this expression is valid. std::nullopt denotes a
0023   /// default entry which is valid in addresses not covered by other location
0024   /// expressions, or everywhere if there are no other expressions.
0025   std::optional<DWARFAddressRange> Range;
0026 
0027   /// The expression itself.
0028   SmallVector<uint8_t, 4> Expr;
0029 };
0030 
0031 inline bool operator==(const DWARFLocationExpression &L,
0032                        const DWARFLocationExpression &R) {
0033   return L.Range == R.Range && L.Expr == R.Expr;
0034 }
0035 
0036 inline bool operator!=(const DWARFLocationExpression &L,
0037                        const DWARFLocationExpression &R) {
0038   return !(L == R);
0039 }
0040 
0041 raw_ostream &operator<<(raw_ostream &OS, const DWARFLocationExpression &Loc);
0042 
0043 /// Represents a set of absolute location expressions.
0044 using DWARFLocationExpressionsVector = std::vector<DWARFLocationExpression>;
0045 
0046 } // end namespace llvm
0047 
0048 #endif // LLVM_DEBUGINFO_DWARF_DWARFLOCATIONEXPRESSION_H