Skip to content

Commit

Permalink
[lldb] Fix unused variable warning in TraceHTR (NFC)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kevcadieux authored and walter-erquinigo committed Jun 30, 2022
1 parent a3f67f0 commit a3ec54c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
Expand Up @@ -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> {
Expand All @@ -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.
Expand Down

0 comments on commit a3ec54c

Please sign in to comment.