From eac00c3be67ffaf831bedabaeb1b558f49c4cec8 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Thu, 2 Nov 2017 21:35:26 +0000 Subject: [PATCH] Fix some warnings found by ToT clang These fall into two categories: - unused variables - (uint8_t *)NULL + X -- changed to reinterpret_cast(X) llvm-svn: 317270 --- lldb/include/lldb/Core/RangeMap.h | 1 - lldb/source/Breakpoint/BreakpointIDList.cpp | 1 - lldb/source/Core/FileSpecList.cpp | 2 +- lldb/source/Core/Value.cpp | 2 +- .../LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp | 2 -- lldb/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp | 4 ---- lldb/source/Symbol/CompilerType.cpp | 2 +- lldb/source/Symbol/Type.cpp | 2 +- lldb/source/Target/PathMappingList.cpp | 1 - lldb/source/Utility/UriParser.cpp | 2 +- 10 files changed, 5 insertions(+), 14 deletions(-) diff --git a/lldb/include/lldb/Core/RangeMap.h b/lldb/include/lldb/Core/RangeMap.h index e37dcd7..91fd409 100644 --- a/lldb/include/lldb/Core/RangeMap.h +++ b/lldb/include/lldb/Core/RangeMap.h @@ -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); diff --git a/lldb/source/Breakpoint/BreakpointIDList.cpp b/lldb/source/Breakpoint/BreakpointIDList.cpp index 0a704fd..6d610d5 100644 --- a/lldb/source/Breakpoint/BreakpointIDList.cpp +++ b/lldb/source/Breakpoint/BreakpointIDList.cpp @@ -139,7 +139,6 @@ void BreakpointIDList::FindAndReplaceIDRanges(Args &old_args, Target *target, return; } - llvm::StringRef range_expr; Status error; std::tie(range_from, range_to) = diff --git a/lldb/source/Core/FileSpecList.cpp b/lldb/source/Core/FileSpecList.cpp index a69f490..d8c1151 100644 --- a/lldb/source/Core/FileSpecList.cpp +++ b/lldb/source/Core/FileSpecList.cpp @@ -49,7 +49,7 @@ void FileSpecList::Append(const FileSpec &file_spec) { // 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; diff --git a/lldb/source/Core/Value.cpp b/lldb/source/Core/Value.cpp index 3f0f9ea..9eb5a49 100644 --- a/lldb/source/Core/Value.cpp +++ b/lldb/source/Core/Value.cpp @@ -535,7 +535,7 @@ Status Value::GetValueAsData(ExecutionContext *exe_ctx, DataExtractor &data, "trying to read from host address of 0."); return error; } - memcpy(dst, (uint8_t *)NULL + address, byte_size); + memcpy(dst, reinterpret_cast(address), byte_size); } else if ((address_type == eAddressTypeLoad) || (address_type == eAddressTypeFile)) { if (file_so_addr.IsValid()) { diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp index 5ac6b19..105c088 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp @@ -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; diff --git a/lldb/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp b/lldb/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp index f907735..e977307 100644 --- a/lldb/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp +++ b/lldb/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp @@ -85,8 +85,6 @@ size_t UnwindMacOSXFrameBackchain::GetStackFrameData_i386( if (process == NULL) return 0; - std::pair fp_pc_pair; - struct Frame_i386 { uint32_t fp; uint32_t pc; @@ -179,8 +177,6 @@ size_t UnwindMacOSXFrameBackchain::GetStackFrameData_x86_64( StackFrame *first_frame = exe_ctx.GetFramePtr(); - std::pair fp_pc_pair; - struct Frame_x86_64 { uint64_t fp; uint64_t pc; diff --git a/lldb/source/Symbol/CompilerType.cpp b/lldb/source/Symbol/CompilerType.cpp index e3880af..16bb534 100644 --- a/lldb/source/Symbol/CompilerType.cpp +++ b/lldb/source/Symbol/CompilerType.cpp @@ -997,7 +997,7 @@ bool CompilerType::ReadFromMemory(lldb_private::ExecutionContext *exe_ctx, 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(addr), byte_size); return true; } else { Process *process = nullptr; diff --git a/lldb/source/Symbol/Type.cpp b/lldb/source/Symbol/Type.cpp index 53d9c5c..53bf3e8 100644 --- a/lldb/source/Symbol/Type.cpp +++ b/lldb/source/Symbol/Type.cpp @@ -404,7 +404,7 @@ bool Type::ReadFromMemory(ExecutionContext *exe_ctx, lldb::addr_t addr, // 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(addr), byte_size); return true; } else { if (exe_ctx) { diff --git a/lldb/source/Target/PathMappingList.cpp b/lldb/source/Target/PathMappingList.cpp index b834a36..782c6e4 100644 --- a/lldb/source/Target/PathMappingList.cpp +++ b/lldb/source/Target/PathMappingList.cpp @@ -85,7 +85,6 @@ void PathMappingList::Insert(const ConstString &path, 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; diff --git a/lldb/source/Utility/UriParser.cpp b/lldb/source/Utility/UriParser.cpp index 5023aa0..a6d81e7 100644 --- a/lldb/source/Utility/UriParser.cpp +++ b/lldb/source/Utility/UriParser.cpp @@ -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); -- 2.7.4