[Lldb-commits] [lldb] r317270 - Fix some warnings found by ToT clang

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Thu Nov 2 14:35:27 PDT 2017


Author: labath
Date: Thu Nov  2 14:35:26 2017
New Revision: 317270

URL: http://llvm.org/viewvc/llvm-project?rev=317270&view=rev
Log:
Fix some warnings found by ToT clang

These fall into two categories:
- unused variables
- (uint8_t *)NULL + X -- changed to reinterpret_cast(X)

Modified:
    lldb/trunk/include/lldb/Core/RangeMap.h
    lldb/trunk/source/Breakpoint/BreakpointIDList.cpp
    lldb/trunk/source/Core/FileSpecList.cpp
    lldb/trunk/source/Core/Value.cpp
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
    lldb/trunk/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp
    lldb/trunk/source/Symbol/CompilerType.cpp
    lldb/trunk/source/Symbol/Type.cpp
    lldb/trunk/source/Target/PathMappingList.cpp
    lldb/trunk/source/Utility/UriParser.cpp

Modified: lldb/trunk/include/lldb/Core/RangeMap.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/RangeMap.h?rev=317270&r1=317269&r2=317270&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/RangeMap.h (original)
+++ lldb/trunk/include/lldb/Core/RangeMap.h Thu Nov  2 14:35:26 2017
@@ -975,7 +975,6 @@ public:
 #endif
 
     if (!m_entries.empty()) {
-      typename Collection::const_iterator pos;
       for (const auto &entry : m_entries) {
         if (entry.Contains(addr))
           indexes.push_back(entry.data);

Modified: lldb/trunk/source/Breakpoint/BreakpointIDList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointIDList.cpp?rev=317270&r1=317269&r2=317270&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointIDList.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointIDList.cpp Thu Nov  2 14:35:26 2017
@@ -139,7 +139,6 @@ void BreakpointIDList::FindAndReplaceIDR
       return;
     }
 
-    llvm::StringRef range_expr;
     Status error;
 
     std::tie(range_from, range_to) =

Modified: lldb/trunk/source/Core/FileSpecList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/FileSpecList.cpp?rev=317270&r1=317269&r2=317270&view=diff
==============================================================================
--- lldb/trunk/source/Core/FileSpecList.cpp (original)
+++ lldb/trunk/source/Core/FileSpecList.cpp Thu Nov  2 14:35:26 2017
@@ -49,7 +49,7 @@ void FileSpecList::Append(const FileSpec
 // contained a copy of "file_spec".
 //------------------------------------------------------------------
 bool FileSpecList::AppendIfUnique(const FileSpec &file_spec) {
-  collection::iterator pos, end = m_files.end();
+  collection::iterator end = m_files.end();
   if (find(m_files.begin(), end, file_spec) == end) {
     m_files.push_back(file_spec);
     return true;

Modified: lldb/trunk/source/Core/Value.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Value.cpp?rev=317270&r1=317269&r2=317270&view=diff
==============================================================================
--- lldb/trunk/source/Core/Value.cpp (original)
+++ lldb/trunk/source/Core/Value.cpp Thu Nov  2 14:35:26 2017
@@ -535,7 +535,7 @@ Status Value::GetValueAsData(ExecutionCo
             "trying to read from host address of 0.");
         return error;
       }
-      memcpy(dst, (uint8_t *)NULL + address, byte_size);
+      memcpy(dst, reinterpret_cast<uint8_t *>(address), byte_size);
     } else if ((address_type == eAddressTypeLoad) ||
                (address_type == eAddressTypeFile)) {
       if (file_so_addr.IsValid()) {

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp?rev=317270&r1=317269&r2=317270&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp Thu Nov  2 14:35:26 2017
@@ -324,8 +324,6 @@ public:
 
     clang::ASTContext &ast_ctx(interface_decl->getASTContext());
 
-    clang::QualType return_qual_type;
-
     const bool isInstance = instance;
     const bool isVariadic = false;
     const bool isSynthesized = false;

Modified: lldb/trunk/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp?rev=317270&r1=317269&r2=317270&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp Thu Nov  2 14:35:26 2017
@@ -85,8 +85,6 @@ size_t UnwindMacOSXFrameBackchain::GetSt
   if (process == NULL)
     return 0;
 
-  std::pair<lldb::addr_t, lldb::addr_t> fp_pc_pair;
-
   struct Frame_i386 {
     uint32_t fp;
     uint32_t pc;
@@ -179,8 +177,6 @@ size_t UnwindMacOSXFrameBackchain::GetSt
 
   StackFrame *first_frame = exe_ctx.GetFramePtr();
 
-  std::pair<lldb::addr_t, lldb::addr_t> fp_pc_pair;
-
   struct Frame_x86_64 {
     uint64_t fp;
     uint64_t pc;

Modified: lldb/trunk/source/Symbol/CompilerType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/CompilerType.cpp?rev=317270&r1=317269&r2=317270&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/CompilerType.cpp (original)
+++ lldb/trunk/source/Symbol/CompilerType.cpp Thu Nov  2 14:35:26 2017
@@ -997,7 +997,7 @@ bool CompilerType::ReadFromMemory(lldb_p
       if (addr == 0)
         return false;
       // The address is an address in this process, so just copy it
-      memcpy(dst, (uint8_t *)nullptr + addr, byte_size);
+      memcpy(dst, reinterpret_cast<uint8_t *>(addr), byte_size);
       return true;
     } else {
       Process *process = nullptr;

Modified: lldb/trunk/source/Symbol/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Type.cpp?rev=317270&r1=317269&r2=317270&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Type.cpp (original)
+++ lldb/trunk/source/Symbol/Type.cpp Thu Nov  2 14:35:26 2017
@@ -404,7 +404,7 @@ bool Type::ReadFromMemory(ExecutionConte
       // The address is an address in this process, so just copy it
       if (addr == 0)
         return false;
-      memcpy(dst, (uint8_t *)nullptr + addr, byte_size);
+      memcpy(dst, reinterpret_cast<uint8_t *>(addr), byte_size);
       return true;
     } else {
       if (exe_ctx) {

Modified: lldb/trunk/source/Target/PathMappingList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/PathMappingList.cpp?rev=317270&r1=317269&r2=317270&view=diff
==============================================================================
--- lldb/trunk/source/Target/PathMappingList.cpp (original)
+++ lldb/trunk/source/Target/PathMappingList.cpp Thu Nov  2 14:35:26 2017
@@ -85,7 +85,6 @@ void PathMappingList::Insert(const Const
 bool PathMappingList::Replace(const ConstString &path,
                               const ConstString &replacement, uint32_t index,
                               bool notify) {
-  iterator insert_iter;
   if (index >= m_pairs.size())
     return false;
   ++m_mod_id;

Modified: lldb/trunk/source/Utility/UriParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/UriParser.cpp?rev=317270&r1=317269&r2=317270&view=diff
==============================================================================
--- lldb/trunk/source/Utility/UriParser.cpp (original)
+++ lldb/trunk/source/Utility/UriParser.cpp Thu Nov  2 14:35:26 2017
@@ -22,7 +22,7 @@ using namespace lldb_private;
 bool UriParser::Parse(llvm::StringRef uri, llvm::StringRef &scheme,
                       llvm::StringRef &hostname, int &port,
                       llvm::StringRef &path) {
-  llvm::StringRef tmp_scheme, tmp_hostname, tmp_port, tmp_path;
+  llvm::StringRef tmp_scheme, tmp_hostname, tmp_path;
 
   const llvm::StringRef kSchemeSep("://");
   auto pos = uri.find(kSchemeSep);




More information about the lldb-commits mailing list