[Lldb-commits] [PATCH] D128874: [lldb] Fix unused variable warning in TraceHTR (NFC)

Kevin Cadieux via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Jun 29 21:03:40 PDT 2022


kevcadieux created this revision.
Herald added a project: All.
kevcadieux requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

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 =


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D128874

Files:
  lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp


Index: lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
===================================================================
--- lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
+++ lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
@@ -132,6 +132,9 @@
   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 @@
       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.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128874.441249.patch
Type: text/x-patch
Size: 1043 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220630/6d4f1ff7/attachment.bin>


More information about the lldb-commits mailing list