[Lldb-commits] [lldb] a3ec54c - [lldb] Fix unused variable warning in TraceHTR (NFC)
Walter Erquinigo via lldb-commits
lldb-commits at lists.llvm.org
Wed Jun 29 21:41:39 PDT 2022
Author: Kevin Cadieux
Date: 2022-06-29T21:29:50-07:00
New Revision: a3ec54c660755f9aae5eeb10e662e79f98437670
URL: https://github.com/llvm/llvm-project/commit/a3ec54c660755f9aae5eeb10e662e79f98437670
DIFF: https://github.com/llvm/llvm-project/commit/a3ec54c660755f9aae5eeb10e662e79f98437670.diff
LOG: [lldb] Fix unused variable warning in TraceHTR (NFC)
A warning was recently introduced in [D128576](https://reviews.llvm.org/D128576) due to now unused lambda `function_name_from_load_address`. This warning causes build failures when treating warnings as errors. This change expands the comment to also include the definition of this lambda, fixing the warning.
Error:
```
[3809/6000] Building CXX object tools/lldb/source/Plugins/TraceExporter/common/CMakeFiles/lldbPluginTraceExporterCommon.dir/TraceHTR.cpp.o
FAILED: tools/lldb/source/Plugins/TraceExporter/common/CMakeFiles/lldbPluginTraceExporterCommon.dir/TraceHTR.cpp.o
/usr/bin/clang++ -DHAVE_ROUND -DLLDB_CONFIGURATION_DEBUG -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/__w/1/b/llvm/Debug/tools/lldb/source/Plugins/TraceExporter/common -I/__w/1/llvm-project/lldb/source/Plugins/TraceExporter/common -I/__w/1/llvm-project/lldb/include -I/__w/1/b/llvm/Debug/tools/lldb/include -I/__w/1/b/llvm/Debug/include -I/__w/1/llvm-project/llvm/include -I/__w/1/llvm-project/llvm/../clang/include -I/__w/1/b/llvm/Debug/tools/lldb/../clang/include -I/__w/1/llvm-project/lldb/source -I/__w/1/b/llvm/Debug/tools/lldb/source -isystem /usr/include/libxml2 -fPIC -fvisibility-inlines-hidden -Werror -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -fdiagnostics-color -Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-strict-aliasing -Wno-deprecated-register -Wno-vla-extension -g -fno-exceptions -gsplit-dwarf -std=c++14 -MD -MT tools/lldb/source/Plugins/TraceExporter/common/CMakeFiles/lldbPluginTraceExporterCommon.dir/TraceHTR.cpp.o -MF tools/lldb/source/Plugins/TraceExporter/common/CMakeFiles/lldbPluginTraceExporterCommon.dir/TraceHTR.cpp.o.d -o tools/lldb/source/Plugins/TraceExporter/common/CMakeFiles/lldbPluginTraceExporterCommon.dir/TraceHTR.cpp.o -c /__w/1/llvm-project/lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
/__w/1/llvm-project/lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp:136:8: error: unused variable 'function_name_from_load_address' [-Werror,-Wunused-variable]
auto function_name_from_load_address =
```
Reviewed By: wallace
Differential Revision: https://reviews.llvm.org/D128874
Added:
Modified:
lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
Removed:
################################################################################
diff --git a/lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp b/lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
index 9225ba44a1463..7deeaf2bf10f9 100644
--- a/lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
+++ b/lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
@@ -132,6 +132,9 @@ TraceHTR::TraceHTR(Thread &thread, TraceCursor &cursor)
cursor.SetForwards(true);
cursor.Seek(0, TraceCursor::SeekType::Beginning);
+ // TODO: fix after persona0220's patch on a new way to access instruction
+ // kinds
+ /*
Target &target = thread.GetProcess()->GetTarget();
auto function_name_from_load_address =
[&](lldb::addr_t load_address) -> llvm::Optional<ConstString> {
@@ -146,8 +149,7 @@ TraceHTR::TraceHTR(Thread &thread, TraceCursor &cursor)
return llvm::None;
};
- /* TODO: fix after persona0220's patch on a new way to access instruction
- kinds while (cursor.HasValue()) { if (cursor.IsError()) {
+ while (cursor.HasValue()) { if (cursor.IsError()) {
// Append a load address of 0 for all instructions that an error occured
// while decoding.
// TODO: Make distinction between errors by storing the error messages.
More information about the lldb-commits
mailing list