[Lldb-commits] [lldb] r353405 - Fix some warnings introduced in r353324 (ReproducerInstrumentation patch)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Thu Feb 7 05:51:38 PST 2019


Author: labath
Date: Thu Feb  7 05:51:38 2019
New Revision: 353405

URL: http://llvm.org/viewvc/llvm-project?rev=353405&view=rev
Log:
Fix some warnings introduced in r353324 (ReproducerInstrumentation patch)

GetIndexForObjectImpl generated a bunch of "conversion casts away
constness warnings". Change the function to use "const void *" (and
static_cast, while I'm at it), to avoid this.

Driver.cpp: unused variable "replay" (this was actually caused by a
subsequent partial revert of this patch). I just finish the revert by
removing the variable completely.

Modified:
    lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h
    lldb/trunk/source/Utility/ReproducerInstrumentation.cpp
    lldb/trunk/tools/driver/Driver.cpp

Modified: lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h?rev=353405&r1=353404&r2=353405&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h (original)
+++ lldb/trunk/include/lldb/Utility/ReproducerInstrumentation.h Thu Feb  7 05:51:38 2019
@@ -431,13 +431,13 @@ struct invoke<void (Class::*)(Args...)>
 class ObjectToIndex {
 public:
   template <typename T> unsigned GetIndexForObject(T *t) {
-    return GetIndexForObjectImpl((void *)t);
+    return GetIndexForObjectImpl(static_cast<const void *>(t));
   }
 
 private:
-  unsigned GetIndexForObjectImpl(void *object);
+  unsigned GetIndexForObjectImpl(const void *object);
 
-  llvm::DenseMap<void *, unsigned> m_mapping;
+  llvm::DenseMap<const void *, unsigned> m_mapping;
 };
 
 /// Serializes functions, their arguments and their return type to a stream.

Modified: lldb/trunk/source/Utility/ReproducerInstrumentation.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/ReproducerInstrumentation.cpp?rev=353405&r1=353404&r2=353405&view=diff
==============================================================================
--- lldb/trunk/source/Utility/ReproducerInstrumentation.cpp (original)
+++ lldb/trunk/source/Utility/ReproducerInstrumentation.cpp Thu Feb  7 05:51:38 2019
@@ -68,7 +68,7 @@ unsigned Registry::GetID(uintptr_t addr)
   return id;
 }
 
-unsigned ObjectToIndex::GetIndexForObjectImpl(void *object) {
+unsigned ObjectToIndex::GetIndexForObjectImpl(const void *object) {
   unsigned index = m_mapping.size() + 1;
   auto it = m_mapping.find(object);
   if (it == m_mapping.end())

Modified: lldb/trunk/tools/driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.cpp?rev=353405&r1=353404&r2=353405&view=diff
==============================================================================
--- lldb/trunk/tools/driver/Driver.cpp (original)
+++ lldb/trunk/tools/driver/Driver.cpp Thu Feb  7 05:51:38 2019
@@ -888,9 +888,6 @@ main(int argc, char const *argv[])
                          << '\n';
   }
 
-  // Remember if we're in replay mode for later.
-  bool replay = false;
-
   SBInitializerOptions options;
   if (auto *arg = input_args.getLastArg(OPT_capture)) {
     auto arg_value = arg->getValue();
@@ -902,7 +899,6 @@ main(int argc, char const *argv[])
     auto arg_value = arg->getValue();
     options.SetReplayReproducer(true);
     options.SetReproducerPath(arg_value);
-    replay = true;
   }
 
   SBError error = SBDebugger::Initialize(options);




More information about the lldb-commits mailing list