Re: [Lldb-commits] [PATCH] D24331: Fix about a dozen compile warnings

2016-09-11 Thread Ilia K via lldb-commits
ki.stfu updated this revision to Diff 70976.
ki.stfu added a comment.

Apply clang-format


https://reviews.llvm.org/D24331

Files:
  source/Core/Log.cpp
  source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  source/Plugins/Process/elf-core/ProcessElfCore.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  source/Plugins/Process/minidump/MinidumpParser.cpp
  source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
  source/Target/StackFrame.cpp

Index: source/Target/StackFrame.cpp
===
--- source/Target/StackFrame.cpp
+++ source/Target/StackFrame.cpp
@@ -1278,6 +1278,8 @@
   return std::make_pair(nullptr, 0);
 }
   }
+  default:
+return std::make_pair(nullptr, 0);
   }
 }
 
@@ -1291,7 +1293,7 @@
   }
   return std::make_pair(nullptr, 0);
 }
-};
+}
 
 lldb::ValueObjectSP StackFrame::GuessValueForAddress(lldb::addr_t addr) {
   TargetSP target_sp = CalculateTarget();
@@ -1420,7 +1422,7 @@
   Error error;
   ValueObjectSP pointee = base->Dereference(error);
 
-  if (offset >= pointee->GetByteSize()) {
+  if (offset >= 0 && uint64_t(offset) >= pointee->GetByteSize()) {
 int64_t index = offset / pointee->GetByteSize();
 offset = offset % pointee->GetByteSize();
 const bool can_create = true;
@@ -1586,17 +1588,16 @@
   continue;
 }
 
-Instruction::Operand *register_operand = nullptr;
 Instruction::Operand *origin_operand = nullptr;
 if (operands[0].m_type == Instruction::Operand::Type::Register &&
 operands[0].m_clobbered == true && operands[0].m_register == reg) {
-  register_operand = [0];
+  // operands[0] is a register operand
   origin_operand = [1];
 } else if (operands[1].m_type == Instruction::Operand::Type::Register &&
operands[1].m_clobbered == true &&
operands[1].m_register == reg) {
-  register_operand = [1];
   origin_operand = [0];
+  // operands[1] is a register operand
 } else {
   continue;
 }
Index: source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
===
--- source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
+++ source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
@@ -518,7 +518,7 @@
   // 0x. If we use the unsigned long long
   // it will work as expected.
   const uint64_t uval = PyLong_AsUnsignedLongLong(m_py_obj);
-  result = *((int64_t *));
+  result = static_cast(uval);
 }
 return result;
   }
Index: source/Plugins/Process/minidump/MinidumpParser.cpp
===
--- source/Plugins/Process/minidump/MinidumpParser.cpp
+++ source/Plugins/Process/minidump/MinidumpParser.cpp
@@ -138,6 +138,8 @@
   case MinidumpCPUArchitecture::ARM64:
 arch_spec.GetTriple().setArch(llvm::Triple::ArchType::aarch64);
 break;
+  default:
+break;
   }
 
   return arch_spec;
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -3653,7 +3653,7 @@
 error.SetErrorStringWithFormat("configuring StructuredData feature %s "
"failed when sending packet: "
"PacketResult=%d",
-   type_name.AsCString(), result);
+   type_name.AsCString(), (int)result);
   }
   return error;
 }
Index: source/Plugins/Process/elf-core/ProcessElfCore.cpp
===
--- source/Plugins/Process/elf-core/ProcessElfCore.cpp
+++ source/Plugins/Process/elf-core/ProcessElfCore.cpp
@@ -139,9 +139,9 @@
   // Keep a separate map of permissions that that isn't coalesced so all ranges
   // are maintained.
   const uint32_t permissions =
-  ((header->p_flags & llvm::ELF::PF_R) ? lldb::ePermissionsReadable : 0) |
-  ((header->p_flags & llvm::ELF::PF_W) ? lldb::ePermissionsWritable : 0) |
-  ((header->p_flags & llvm::ELF::PF_X) ? lldb::ePermissionsExecutable : 0);
+  ((header->p_flags & llvm::ELF::PF_R) ? lldb::ePermissionsReadable : 0u) |
+  ((header->p_flags & llvm::ELF::PF_W) ? lldb::ePermissionsWritable : 0u) |
+  ((header->p_flags & llvm::ELF::PF_X) ? lldb::ePermissionsExecutable : 0u);
 
   m_core_range_infos.Append(
   VMRangeToPermissions::Entry(addr, header->p_memsz, permissions));
Index: source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
===
--- source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -1458,13 

Re: [Lldb-commits] [PATCH] D24331: Fix about a dozen compile warnings

2016-09-08 Thread Ilia K via lldb-commits
ki.stfu marked an inline comment as done.


Comment at: source/Target/StackFrame.cpp:1425
@@ -1423,3 +1424,3 @@
 
-  if (offset >= pointee->GetByteSize()) {
+  if (offset > 0 && uint64_t(offset) >= pointee->GetByteSize()) {
 int64_t index = offset / pointee->GetByteSize();

Good point. Thanks!


https://reviews.llvm.org/D24331



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D24331: Fix about a dozen compile warnings

2016-09-08 Thread Ilia K via lldb-commits
ki.stfu updated this revision to Diff 70656.
ki.stfu marked 3 inline comments as done.
ki.stfu added a comment.

Fixes per Zachary's comments


https://reviews.llvm.org/D24331

Files:
  source/Core/Log.cpp
  source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  source/Plugins/Process/elf-core/ProcessElfCore.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  source/Plugins/Process/minidump/MinidumpParser.cpp
  source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
  source/Target/StackFrame.cpp

Index: source/Target/StackFrame.cpp
===
--- source/Target/StackFrame.cpp
+++ source/Target/StackFrame.cpp
@@ -853,10 +853,9 @@
 } else {
   ValueObjectSP synthetic = valobj_sp->GetSyntheticValue();
   if (no_synth_child /* synthetic is forbidden */ ||
-  !synthetic /* no synthetic */
-  ||
-  synthetic == valobj_sp) /* synthetic is the same as the
- original object */
+  !synthetic /* no synthetic */
+  || synthetic == valobj_sp) /* synthetic is the same as the
+original object */
   {
 valobj_sp->GetExpressionPath(var_expr_path_strm, false);
 error.SetErrorStringWithFormat(
@@ -1279,6 +1278,8 @@
   return std::make_pair(nullptr, 0);
 }
   }
+  default:
+return std::make_pair(nullptr, 0);
   }
 }
 
@@ -1292,7 +1293,7 @@
   }
   return std::make_pair(nullptr, 0);
 }
-};
+}
 
 lldb::ValueObjectSP StackFrame::GuessValueForAddress(lldb::addr_t addr) {
   TargetSP target_sp = CalculateTarget();
@@ -1421,7 +1422,7 @@
   Error error;
   ValueObjectSP pointee = base->Dereference(error);
 
-  if (offset >= pointee->GetByteSize()) {
+  if (offset >= 0 && uint64_t(offset) >= pointee->GetByteSize()) {
 int64_t index = offset / pointee->GetByteSize();
 offset = offset % pointee->GetByteSize();
 const bool can_create = true;
@@ -1587,17 +1588,16 @@
   continue;
 }
 
-Instruction::Operand *register_operand = nullptr;
 Instruction::Operand *origin_operand = nullptr;
 if (operands[0].m_type == Instruction::Operand::Type::Register &&
 operands[0].m_clobbered == true && operands[0].m_register == reg) {
-  register_operand = [0];
+  // operands[0] is a register operand
   origin_operand = [1];
 } else if (operands[1].m_type == Instruction::Operand::Type::Register &&
operands[1].m_clobbered == true &&
operands[1].m_register == reg) {
-  register_operand = [1];
   origin_operand = [0];
+  // operands[1] is a register operand
 } else {
   continue;
 }
Index: source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
===
--- source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
+++ source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
@@ -518,7 +518,7 @@
   // 0x. If we use the unsigned long long
   // it will work as expected.
   const uint64_t uval = PyLong_AsUnsignedLongLong(m_py_obj);
-  result = *((int64_t *));
+  result = static_cast(uval);
 }
 return result;
   }
Index: source/Plugins/Process/minidump/MinidumpParser.cpp
===
--- source/Plugins/Process/minidump/MinidumpParser.cpp
+++ source/Plugins/Process/minidump/MinidumpParser.cpp
@@ -138,6 +138,8 @@
   case MinidumpCPUArchitecture::ARM64:
 arch_spec.GetTriple().setArch(llvm::Triple::ArchType::aarch64);
 break;
+  default:
+break;
   }
 
   return arch_spec;
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -3567,7 +3567,7 @@
 error.SetErrorStringWithFormat("configuring StructuredData feature %s "
"failed when sending packet: "
"PacketResult=%d",
-   type_name.AsCString(), result);
+   type_name.AsCString(), (int)result);
   }
   return error;
 }
Index: source/Plugins/Process/elf-core/ProcessElfCore.cpp
===
--- source/Plugins/Process/elf-core/ProcessElfCore.cpp
+++ source/Plugins/Process/elf-core/ProcessElfCore.cpp
@@ -139,9 +139,9 @@
   // Keep a separate map of permissions that that isn't coalesced so all ranges
   // are maintained.
   const uint32_t permissions =
-   

Re: [Lldb-commits] [PATCH] D24331: Fix about a dozen compile warnings

2016-09-08 Thread Zachary Turner via lldb-commits
zturner added inline comments.


Comment at: source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp:1462-1467
@@ -1461,8 +1461,8 @@
 const uint32_t segment_permissions =
 ((load_cmd.initprot & VM_PROT_READ) ? ePermissionsReadable
-: 0) |
+: 0u) |
 ((load_cmd.initprot & VM_PROT_WRITE) ? ePermissionsWritable
- : 0) |
+ : 0u) |
 ((load_cmd.initprot & VM_PROT_EXECUTE) ? ePermissionsExecutable
-   : 0);
+   : 0u);
 

I find this code pretty ugly because of how the line breaks.  Can you change 
this to:

```
uint32_t segment_permissions = 0;
if (load_cmd.initprot & VM_PROT_READ)
  segment_permissions |= ePermissionsReadable;
if (load_cmd.initprot & VM_PROT_WRITE)
  segment_permissions |= ePermissionsWritable;
if (load_cmd.initprot & VM_PROT_EXECUTE)
  segment_permissions |= ePermissionsExecutable;
```

or, alternatively:

```
// global scope
static uint32_t translateSegmentPermissions(uint32_t initprot) {
  return ((initprot & VM_PROT_READ) ? ePermissionsReadable : 0u) |
  (initprot & VM_PROT_WRITE) ? ePermissionsWritable : 0u) |
  (initprot & VM_PROT_EXECUTE) ? ePermissionsExecutable : 0u);
}

// at this location
const uint32_t segment_permissions = 
translateSegmentPermissions(load_cmd.initprot);
```


Comment at: source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp:521
@@ -520,3 +520,3 @@
   const uint64_t uval = PyLong_AsUnsignedLongLong(m_py_obj);
-  result = *((int64_t *));
+  result = *((const int64_t *));
 }

Am I missing something?  Why isn't this just `result = 
static_cast(uval);`


Comment at: source/Target/StackFrame.cpp:1427
@@ -1423,3 +1426,3 @@
 
-  if (offset >= pointee->GetByteSize()) {
+  if (offset > 0 && uint64_t(offset) >= pointee->GetByteSize()) {
 int64_t index = offset / pointee->GetByteSize();

Probably only of theoretical interest since I don't think 
`pointee->GetByteSize()` can ever return 0, but maybe this should be `offset >= 
0`


Comment at: source/Target/StackFrame.cpp:1593
@@ -1589,3 +1592,3 @@
 
 Instruction::Operand *register_operand = nullptr;
 Instruction::Operand *origin_operand = nullptr;

How about just delete this variable instead?


https://reviews.llvm.org/D24331



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D24331: Fix about a dozen compile warnings

2016-09-08 Thread Ilia K via lldb-commits
ki.stfu updated this revision to Diff 70654.
ki.stfu added a comment.

Apply clang-format


https://reviews.llvm.org/D24331

Files:
  source/Core/Log.cpp
  source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  source/Plugins/Process/elf-core/ProcessElfCore.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  source/Plugins/Process/minidump/MinidumpParser.cpp
  source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
  source/Target/StackFrame.cpp

Index: source/Target/StackFrame.cpp
===
--- source/Target/StackFrame.cpp
+++ source/Target/StackFrame.cpp
@@ -853,10 +853,9 @@
 } else {
   ValueObjectSP synthetic = valobj_sp->GetSyntheticValue();
   if (no_synth_child /* synthetic is forbidden */ ||
-  !synthetic /* no synthetic */
-  ||
-  synthetic == valobj_sp) /* synthetic is the same as the
- original object */
+  !synthetic /* no synthetic */
+  || synthetic == valobj_sp) /* synthetic is the same as the
+original object */
   {
 valobj_sp->GetExpressionPath(var_expr_path_strm, false);
 error.SetErrorStringWithFormat(
@@ -1279,6 +1278,8 @@
   return std::make_pair(nullptr, 0);
 }
   }
+  default:
+return std::make_pair(nullptr, 0);
   }
 }
 
@@ -1292,7 +1293,7 @@
   }
   return std::make_pair(nullptr, 0);
 }
-};
+}
 
 lldb::ValueObjectSP StackFrame::GuessValueForAddress(lldb::addr_t addr) {
   TargetSP target_sp = CalculateTarget();
@@ -1421,7 +1422,7 @@
   Error error;
   ValueObjectSP pointee = base->Dereference(error);
 
-  if (offset >= pointee->GetByteSize()) {
+  if (offset > 0 && uint64_t(offset) >= pointee->GetByteSize()) {
 int64_t index = offset / pointee->GetByteSize();
 offset = offset % pointee->GetByteSize();
 const bool can_create = true;
@@ -1602,6 +1603,9 @@
   continue;
 }
 
+// Ignore an unused-variable warning for a register operand.
+(void)register_operand;
+
 // We have an origin operand.  Can we track its value down?
 switch (origin_operand->m_type) {
 default:
Index: source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
===
--- source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
+++ source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
@@ -518,7 +518,7 @@
   // 0x. If we use the unsigned long long
   // it will work as expected.
   const uint64_t uval = PyLong_AsUnsignedLongLong(m_py_obj);
-  result = *((int64_t *));
+  result = *((const int64_t *));
 }
 return result;
   }
Index: source/Plugins/Process/minidump/MinidumpParser.cpp
===
--- source/Plugins/Process/minidump/MinidumpParser.cpp
+++ source/Plugins/Process/minidump/MinidumpParser.cpp
@@ -138,6 +138,8 @@
   case MinidumpCPUArchitecture::ARM64:
 arch_spec.GetTriple().setArch(llvm::Triple::ArchType::aarch64);
 break;
+  default:
+break;
   }
 
   return arch_spec;
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -3567,7 +3567,7 @@
 error.SetErrorStringWithFormat("configuring StructuredData feature %s "
"failed when sending packet: "
"PacketResult=%d",
-   type_name.AsCString(), result);
+   type_name.AsCString(), (int)result);
   }
   return error;
 }
Index: source/Plugins/Process/elf-core/ProcessElfCore.cpp
===
--- source/Plugins/Process/elf-core/ProcessElfCore.cpp
+++ source/Plugins/Process/elf-core/ProcessElfCore.cpp
@@ -139,9 +139,9 @@
   // Keep a separate map of permissions that that isn't coalesced so all ranges
   // are maintained.
   const uint32_t permissions =
-  ((header->p_flags & llvm::ELF::PF_R) ? lldb::ePermissionsReadable : 0) |
-  ((header->p_flags & llvm::ELF::PF_W) ? lldb::ePermissionsWritable : 0) |
-  ((header->p_flags & llvm::ELF::PF_X) ? lldb::ePermissionsExecutable : 0);
+  ((header->p_flags & llvm::ELF::PF_R) ? lldb::ePermissionsReadable : 0u) |
+  ((header->p_flags & llvm::ELF::PF_W) ? lldb::ePermissionsWritable : 0u) |
+  ((header->p_flags & llvm::ELF::PF_X) ? lldb::ePermissionsExecutable : 0u);
 
   m_core_range_infos.Append(

Re: [Lldb-commits] [PATCH] D24331: Fix about a dozen compile warnings

2016-09-08 Thread Ilia K via lldb-commits
ki.stfu added a comment.

BTW, the following warnings remain:

1. unrecognized command line option ‘-Wno-vla-extension’
2. unrecognized command line option ‘-Wno-deprecated-register’
3. comparison of unsigned expression >= 0 is always true

  [2782/3295] Building CXX object 
tools/lldb/source/Plugins/Instruction/ARM/CMakeFiles/lldbPluginInstructionARM.dir/EmulationStateARM.cpp.o
  ../tools/lldb/source/Plugins/Instruction/ARM/EmulationStateARM.cpp: In member 
function ‘bool EmulationStateARM::StorePseudoRegisterValue(uint32_t, uint64_t)’:
  ../tools/lldb/source/Plugins/Instruction/ARM/EmulationStateARM.cpp:69:17: 
warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
 if ((dwarf_r0 <= reg_num) && (reg_num <= dwarf_cpsr))
   ^
  ../tools/lldb/source/Plugins/Instruction/ARM/EmulationStateARM.cpp: In member 
function ‘uint64_t EmulationStateARM::ReadPseudoRegisterValue(uint32_t, bool&)’:
  ../tools/lldb/source/Plugins/Instruction/ARM/EmulationStateARM.cpp:92:17: 
warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
 if ((dwarf_r0 <= reg_num) && (reg_num <= dwarf_cpsr))
   ^
  ...
  [3136/3295] Building CXX object 
tools/lldb/source/Utility/CMakeFiles/lldbUtility.dir/ARM64_DWARF_Registers.cpp.o
  ../tools/lldb/source/Utility/ARM64_DWARF_Registers.cpp: In function ‘bool 
arm64_dwarf::GetRegisterInfo(unsigned int, lldb_private::RegisterInfo&)’:
  ../tools/lldb/source/Utility/ARM64_DWARF_Registers.cpp:175:15: warning: 
comparison of unsigned expression >= 0 is always true [-Wtype-limits]
 if (reg_num >= x0 && reg_num <= pc) {
 ^

4. format not a string literal and no format arguments

  [3217/3295] Building CXX object 
tools/lldb/source/API/CMakeFiles/liblldb.dir/__/__/scripts/LLDBWrapPython.cpp.o
  tools/lldb/scripts/LLDBWrapPython.cpp: In function ‘PyObject* 
_wrap_SBError_SetErrorStringWithFormat__SWIG_3(PyObject*, PyObject*)’:
  tools/lldb/scripts/LLDBWrapPython.cpp:28426:70: warning: format not a string 
literal and no format arguments [-Wformat-security]
   result = (int)(arg1)->SetErrorStringWithFormat((char const *)arg2);
^

5. comparison between signed and unsigned integer expressions

  tools/lldb/scripts/LLDBWrapPython.cpp: In function ‘PyObject* 
_wrap_SBTarget_BreakpointCreateByNames__SWIG_0(PyObject*, PyObject*)’:
  tools/lldb/scripts/LLDBWrapPython.cpp:55744:21: warning: comparison between 
signed and unsigned integer expressions [-Wsign-compare]
 for (i = 0; i < arg3; i++) {
   ^
  tools/lldb/scripts/LLDBWrapPython.cpp: In function ‘PyObject* 
_wrap_SBTarget_BreakpointCreateByNames__SWIG_1(PyObject*, PyObject*)’:
  tools/lldb/scripts/LLDBWrapPython.cpp:55836:21: warning: comparison between 
signed and unsigned integer expressions [-Wsign-compare]
 for (i = 0; i < arg3; i++) {
   ^
  tools/lldb/scripts/LLDBWrapPython.cpp: In function ‘PyObject* 
_wrap_SBTarget_BreakpointCreateByNames__SWIG_2(PyObject*, PyObject*)’:
  tools/lldb/scripts/LLDBWrapPython.cpp:55937:21: warning: comparison between 
signed and unsigned integer expressions [-Wsign-compare]
 for (i = 0; i < arg3; i++) {
   ^


https://reviews.llvm.org/D24331



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D24331: Fix about a dozen compile warnings

2016-09-08 Thread Ilia K via lldb-commits
ki.stfu created this revision.
ki.stfu added reviewers: clayborg, jingham, zturner.
ki.stfu added a subscriber: lldb-commits.

It fixes the following compile warnings:
1. '0' flag ignored with precision and ‘%d’ gnu_printf format
2. enumeral and non-enumeral type in conditional expression
3. format ‘%d’ expects argument of type ‘int’, but argument 4 has type ...
4. enumeration value ‘...’ not handled in switch
5. cast from type ‘const uint64_t* {aka ...}’ to type ‘int64_t* {aka ...}’ 
casts away qualifiers
6. extra ‘;’
7. comparison between signed and unsigned integer expressions
8. variable ‘register_operand’ set but not used
9. control reaches end of non-void function

https://reviews.llvm.org/D24331

Files:
  source/Core/Log.cpp
  source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  source/Plugins/Process/elf-core/ProcessElfCore.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  source/Plugins/Process/minidump/MinidumpParser.cpp
  source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
  source/Target/StackFrame.cpp

Index: source/Target/StackFrame.cpp
===
--- source/Target/StackFrame.cpp
+++ source/Target/StackFrame.cpp
@@ -1279,6 +1279,9 @@
   return std::make_pair(nullptr, 0);
 }
   }
+  default:
+// Make compiler happy with adding default case
+return std::make_pair(nullptr, 0);
   }
 }
 
@@ -1292,7 +1295,7 @@
   }
   return std::make_pair(nullptr, 0);
 }
-};
+}
 
 lldb::ValueObjectSP StackFrame::GuessValueForAddress(lldb::addr_t addr) {
   TargetSP target_sp = CalculateTarget();
@@ -1421,7 +1424,7 @@
   Error error;
   ValueObjectSP pointee = base->Dereference(error);
 
-  if (offset >= pointee->GetByteSize()) {
+  if (offset > 0 && uint64_t(offset) >= pointee->GetByteSize()) {
 int64_t index = offset / pointee->GetByteSize();
 offset = offset % pointee->GetByteSize();
 const bool can_create = true;
@@ -1602,6 +1605,9 @@
   continue;
 }
 
+// Ignore an unused-variable warning for a register operand.
+(void)register_operand;
+
 // We have an origin operand.  Can we track its value down?
 switch (origin_operand->m_type) {
 default:
Index: source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
===
--- source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
+++ source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
@@ -518,7 +518,7 @@
   // 0x. If we use the unsigned long long
   // it will work as expected.
   const uint64_t uval = PyLong_AsUnsignedLongLong(m_py_obj);
-  result = *((int64_t *));
+  result = *((const int64_t *));
 }
 return result;
   }
Index: source/Plugins/Process/minidump/MinidumpParser.cpp
===
--- source/Plugins/Process/minidump/MinidumpParser.cpp
+++ source/Plugins/Process/minidump/MinidumpParser.cpp
@@ -138,6 +138,8 @@
   case MinidumpCPUArchitecture::ARM64:
 arch_spec.GetTriple().setArch(llvm::Triple::ArchType::aarch64);
 break;
+  default:
+break;
   }
 
   return arch_spec;
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -3567,7 +3567,7 @@
 error.SetErrorStringWithFormat("configuring StructuredData feature %s "
"failed when sending packet: "
"PacketResult=%d",
-   type_name.AsCString(), result);
+   type_name.AsCString(), (int)result);
   }
   return error;
 }
Index: source/Plugins/Process/elf-core/ProcessElfCore.cpp
===
--- source/Plugins/Process/elf-core/ProcessElfCore.cpp
+++ source/Plugins/Process/elf-core/ProcessElfCore.cpp
@@ -139,9 +139,9 @@
   // Keep a separate map of permissions that that isn't coalesced so all ranges
   // are maintained.
   const uint32_t permissions =
-  ((header->p_flags & llvm::ELF::PF_R) ? lldb::ePermissionsReadable : 0) |
-  ((header->p_flags & llvm::ELF::PF_W) ? lldb::ePermissionsWritable : 0) |
-  ((header->p_flags & llvm::ELF::PF_X) ? lldb::ePermissionsExecutable : 0);
+  ((header->p_flags & llvm::ELF::PF_R) ? lldb::ePermissionsReadable : 0u) |
+  ((header->p_flags & llvm::ELF::PF_W) ? lldb::ePermissionsWritable : 0u) |
+  ((header->p_flags & llvm::ELF::PF_X) ? lldb::ePermissionsExecutable : 0u);
 
   m_core_range_infos.Append(
   VMRangeToPermissions::Entry(addr, header->p_memsz, permissions));
Index: source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp