[PATCH] D113958: DebugInfo: Make DWARFExpression::iterator a const iterator
Duncan P. N. Exon Smith via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 15 17:41:50 PST 2021
dexonsmith updated this revision to Diff 387458.
dexonsmith added a comment.
[No change; just re-triggering builds after telling Phabricator this depends on the other patch.]
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D113958/new/
https://reviews.llvm.org/D113958
Files:
llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h
llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp
llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
llvm/tools/llvm-dwarfdump/Statistics.cpp
Index: llvm/tools/llvm-dwarfdump/Statistics.cpp
===================================================================
--- llvm/tools/llvm-dwarfdump/Statistics.cpp
+++ llvm/tools/llvm-dwarfdump/Statistics.cpp
@@ -322,7 +322,7 @@
U->getFormParams().Format);
// Consider the expression containing the DW_OP_entry_value as
// an entry value.
- return llvm::any_of(Expression, [](DWARFExpression::Operation &Op) {
+ return llvm::any_of(Expression, [](const DWARFExpression::Operation &Op) {
return Op.getCode() == dwarf::DW_OP_entry_value ||
Op.getCode() == dwarf::DW_OP_GNU_entry_value;
});
Index: llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
===================================================================
--- llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
+++ llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
@@ -552,9 +552,10 @@
DataExtractor Data(toStringRef(Entry.Expr), DCtx.isLittleEndian(), 0);
DWARFExpression Expression(Data, U->getAddressByteSize(),
U->getFormParams().Format);
- bool Error = any_of(Expression, [](DWARFExpression::Operation &Op) {
- return Op.isError();
- });
+ bool Error =
+ any_of(Expression, [](const DWARFExpression::Operation &Op) {
+ return Op.isError();
+ });
if (Error || !Expression.verify(U))
ReportError("DIE contains invalid DWARF expression:");
}
@@ -1400,11 +1401,12 @@
U->getAddressByteSize());
DWARFExpression Expression(Data, U->getAddressByteSize(),
U->getFormParams().Format);
- bool IsInteresting = any_of(Expression, [](DWARFExpression::Operation &Op) {
- return !Op.isError() && (Op.getCode() == DW_OP_addr ||
- Op.getCode() == DW_OP_form_tls_address ||
- Op.getCode() == DW_OP_GNU_push_tls_address);
- });
+ bool IsInteresting =
+ any_of(Expression, [](const DWARFExpression::Operation &Op) {
+ return !Op.isError() && (Op.getCode() == DW_OP_addr ||
+ Op.getCode() == DW_OP_form_tls_address ||
+ Op.getCode() == DW_OP_GNU_push_tls_address);
+ });
if (IsInteresting)
return true;
}
Index: llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp
===================================================================
--- llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp
+++ llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp
@@ -408,7 +408,7 @@
SmallVector<PrintedExpr, 4> Stack;
while (I != E) {
- DWARFExpression::Operation &Op = *I;
+ const DWARFExpression::Operation &Op = *I;
uint8_t Opcode = Op.getCode();
switch (Opcode) {
case dwarf::DW_OP_regx: {
Index: llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h
===================================================================
--- llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h
+++ llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h
@@ -109,11 +109,11 @@
/// An iterator to go through the expression operations.
class iterator
: public iterator_facade_base<iterator, std::forward_iterator_tag,
- Operation> {
+ const Operation> {
friend class DWARFExpression;
const DWARFExpression *Expr;
uint64_t Offset;
- mutable Operation Op;
+ Operation Op;
iterator(const DWARFExpression *Expr, uint64_t Offset)
: Expr(Expr), Offset(Offset) {
Op.Error =
@@ -130,7 +130,7 @@
return *this;
}
- class Operation &operator*() const {
+ const class Operation &operator*() const {
return Op;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113958.387458.patch
Type: text/x-patch
Size: 3800 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211116/597799a4/attachment.bin>
More information about the llvm-commits
mailing list