[Lldb-commits] [lldb] [NFC] Use the DWARFExpression::Stack typedef (PR #167018)
via lldb-commits
lldb-commits at lists.llvm.org
Fri Nov 7 12:47:22 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: David Peixotto (dmpots)
<details>
<summary>Changes</summary>
This commit updates the places where we were passing around the dwarf expression stack to use the typedef value instead of redeclaring the underlying vector type.
It looked like a nice cleanup to use the typedef instead.
---
Full diff: https://github.com/llvm/llvm-project/pull/167018.diff
8 Files Affected:
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp (+2-1)
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h (+5-5)
- (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (+2-1)
- (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp (+1-1)
- (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h (+1-1)
- (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileWasm.cpp (+4-6)
- (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileWasm.h (+2-1)
- (modified) lldb/unittests/Expression/DWARFExpressionTest.cpp (+5-5)
``````````diff
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
index 94fc2e83e899d..ea1ad71f0b3dc 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -9,6 +9,7 @@
#include "DWARFUnit.h"
#include "lldb/Core/Module.h"
+#include "lldb/Expression/DWARFExpression.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Utility/LLDBAssert.h"
#include "lldb/Utility/StreamString.h"
@@ -738,7 +739,7 @@ bool DWARFUnit::ParseVendorDWARFOpcode(uint8_t op, const DataExtractor &opcodes,
lldb::offset_t &offset,
RegisterContext *reg_ctx,
lldb::RegisterKind reg_kind,
- std::vector<Value> &stack) const {
+ DWARFExpression::Stack &stack) const {
return GetSymbolFileDWARF().ParseVendorDWARFOpcode(op, opcodes, offset,
reg_ctx, reg_kind, stack);
}
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
index 91a693860c55a..80a1ccf794f8b 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
@@ -164,11 +164,11 @@ class DWARFUnit : public DWARFExpression::Delegate, public UserID {
const lldb::offset_t data_offset,
const uint8_t op) const override;
- virtual bool ParseVendorDWARFOpcode(uint8_t op, const DataExtractor &opcodes,
- lldb::offset_t &offset,
- RegisterContext *reg_ctx,
- lldb::RegisterKind reg_kind,
- std::vector<Value> &stack) const override;
+ virtual bool
+ ParseVendorDWARFOpcode(uint8_t op, const DataExtractor &opcodes,
+ lldb::offset_t &offset, RegisterContext *reg_ctx,
+ lldb::RegisterKind reg_kind,
+ DWARFExpression::Stack &stack) const override;
bool ParseDWARFLocationList(const DataExtractor &data,
DWARFExpressionList &loc_list) const;
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
index a60527b8eda33..018a617bb85bf 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -22,6 +22,7 @@
#include "lldb/Core/UniqueCStringMap.h"
#include "lldb/Core/dwarf.h"
+#include "lldb/Expression/DWARFExpression.h"
#include "lldb/Expression/DWARFExpressionList.h"
#include "lldb/Symbol/DebugMacros.h"
#include "lldb/Symbol/SymbolContext.h"
@@ -334,7 +335,7 @@ class SymbolFileDWARF : public SymbolFileCommon {
lldb::offset_t &offset,
RegisterContext *reg_ctx,
lldb::RegisterKind reg_kind,
- std::vector<Value> &stack) const {
+ DWARFExpression::Stack &stack) const {
return false;
}
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
index 60d87c3fc2559..82b7999be1130 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
@@ -99,7 +99,7 @@ uint64_t SymbolFileDWARFDwo::GetDebugInfoSize(bool load_all_debug_info) {
bool SymbolFileDWARFDwo::ParseVendorDWARFOpcode(
uint8_t op, const DataExtractor &opcodes, lldb::offset_t &offset,
RegisterContext *reg_ctx, lldb::RegisterKind reg_kind,
- std::vector<Value> &stack) const {
+ DWARFExpression::Stack &stack) const {
return GetBaseSymbolFile().ParseVendorDWARFOpcode(op, opcodes, offset,
reg_ctx, reg_kind, stack);
}
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
index d906e09fe81ab..1c4819ff9dafa 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
@@ -54,7 +54,7 @@ class SymbolFileDWARFDwo : public SymbolFileDWARF {
bool ParseVendorDWARFOpcode(uint8_t op, const DataExtractor &opcodes,
lldb::offset_t &offset, RegisterContext *reg_ctx,
lldb::RegisterKind reg_kind,
- std::vector<Value> &stack) const override;
+ DWARFExpression::Stack &stack) const override;
void FindGlobalVariables(ConstString name,
const CompilerDeclContext &parent_decl_ctx,
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileWasm.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileWasm.cpp
index e25a89cfe26b2..f53b9f767f495 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileWasm.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileWasm.cpp
@@ -46,12 +46,10 @@ SymbolFileWasm::GetVendorDWARFOpcodeSize(const DataExtractor &data,
return offset - data_offset;
}
-bool SymbolFileWasm::ParseVendorDWARFOpcode(uint8_t op,
- const DataExtractor &opcodes,
- lldb::offset_t &offset,
- RegisterContext *reg_ctx,
- lldb::RegisterKind reg_kind,
- std::vector<Value> &stack) const {
+bool SymbolFileWasm::ParseVendorDWARFOpcode(
+ uint8_t op, const DataExtractor &opcodes, lldb::offset_t &offset,
+ RegisterContext *reg_ctx, lldb::RegisterKind reg_kind,
+ DWARFExpression::Stack &stack) const {
if (op != llvm::dwarf::DW_OP_WASM_location)
return false;
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileWasm.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileWasm.h
index 0e0b742f53f18..6ab2e0871a1a5 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileWasm.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileWasm.h
@@ -10,6 +10,7 @@
#define LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_SYMBOLFILEWASM_H
#include "SymbolFileDWARF.h"
+#include "lldb/Expression/DWARFExpression.h"
namespace lldb_private::plugin {
namespace dwarf {
@@ -26,7 +27,7 @@ class SymbolFileWasm : public SymbolFileDWARF {
bool ParseVendorDWARFOpcode(uint8_t op, const DataExtractor &opcodes,
lldb::offset_t &offset, RegisterContext *reg_ctx,
lldb::RegisterKind reg_kind,
- std::vector<Value> &stack) const override;
+ DWARFExpression::Stack &stack) const override;
};
} // namespace dwarf
} // namespace lldb_private::plugin
diff --git a/lldb/unittests/Expression/DWARFExpressionTest.cpp b/lldb/unittests/Expression/DWARFExpressionTest.cpp
index 9d11060becfae..d09224a70395e 100644
--- a/lldb/unittests/Expression/DWARFExpressionTest.cpp
+++ b/lldb/unittests/Expression/DWARFExpressionTest.cpp
@@ -743,12 +743,12 @@ class CustomSymbolFileDWARF : public SymbolFileDWARF {
return offset - data_offset;
}
- virtual bool ParseVendorDWARFOpcode(
- uint8_t op, const lldb_private::DataExtractor &opcodes,
- lldb::offset_t &offset,
+ virtual bool
+ ParseVendorDWARFOpcode(uint8_t op, const lldb_private::DataExtractor &opcodes,
+ lldb::offset_t &offset,
- RegisterContext *reg_ctx, lldb::RegisterKind reg_kind,
- std::vector<lldb_private::Value> &stack) const override {
+ RegisterContext *reg_ctx, lldb::RegisterKind reg_kind,
+ DWARFExpression::Stack &stack) const override {
if (op != DW_OP_WASM_location) {
return false;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/167018
More information about the lldb-commits
mailing list