[Lldb-commits] [lldb] r291198 - Make lldb -Werror clean for -Wstring-conversion

David Blaikie via lldb-commits lldb-commits at lists.llvm.org
Thu Jan 5 16:38:07 PST 2017


Author: dblaikie
Date: Thu Jan  5 18:38:06 2017
New Revision: 291198

URL: http://llvm.org/viewvc/llvm-project?rev=291198&view=rev
Log:
Make lldb -Werror clean for -Wstring-conversion

Also found/fixed one bug identified by this warning in
RenderScriptx86ABIFixups.cpp where a string literal was being used in an
effort to provide a name for an instruction/register, but was instead
being passed as the bool 'isVolatile' parameter.

Modified:
    lldb/trunk/include/lldb/Core/MappedHash.h
    lldb/trunk/source/Core/DataEncoder.cpp
    lldb/trunk/source/Core/ValueObjectMemory.cpp
    lldb/trunk/source/Expression/IRInterpreter.cpp
    lldb/trunk/source/Host/windows/EditLineWin.cpp
    lldb/trunk/source/Interpreter/OptionValueProperties.cpp
    lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp
    lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
    lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp
    lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
    lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
    lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
    lldb/trunk/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
    lldb/trunk/source/Symbol/ClangASTContext.cpp
    lldb/trunk/source/Symbol/Type.cpp
    lldb/trunk/source/Target/ABI.cpp
    lldb/trunk/source/Target/Platform.cpp
    lldb/trunk/source/Target/StackFrameList.cpp
    lldb/trunk/tools/debugserver/source/DNBDataRef.cpp
    lldb/trunk/tools/driver/Platform.cpp
    lldb/trunk/tools/lldb-perf/lib/Results.cpp

Modified: lldb/trunk/include/lldb/Core/MappedHash.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/MappedHash.h?rev=291198&r1=291197&r2=291198&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/MappedHash.h (original)
+++ lldb/trunk/include/lldb/Core/MappedHash.h Thu Jan  5 18:38:06 2017
@@ -52,8 +52,7 @@ public:
     default:
       break;
     }
-    assert(!"Invalid hash function index");
-    return 0;
+    llvm_unreachable("Invalid hash function index");
   }
 
   static const uint32_t HASH_MAGIC = 0x48415348u;

Modified: lldb/trunk/source/Core/DataEncoder.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/DataEncoder.cpp?rev=291198&r1=291197&r2=291198&view=diff
==============================================================================
--- lldb/trunk/source/Core/DataEncoder.cpp (original)
+++ lldb/trunk/source/Core/DataEncoder.cpp Thu Jan  5 18:38:06 2017
@@ -258,8 +258,7 @@ uint32_t DataEncoder::PutMaxU64(uint32_t
   case 8:
     return PutU64(offset, value);
   default:
-    assert(!"GetMax64 unhandled case!");
-    break;
+    llvm_unreachable("GetMax64 unhandled case!");
   }
   return UINT32_MAX;
 }

Modified: lldb/trunk/source/Core/ValueObjectMemory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectMemory.cpp?rev=291198&r1=291197&r2=291198&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectMemory.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectMemory.cpp Thu Jan  5 18:38:06 2017
@@ -165,8 +165,7 @@ bool ValueObjectMemory::UpdateValue() {
 
     switch (value_type) {
     default:
-      assert(!"Unhandled expression result value kind...");
-      break;
+      llvm_unreachable("Unhandled expression result value kind...");
 
     case Value::eValueTypeScalar:
       // The variable value is in the Scalar value inside the m_value.

Modified: lldb/trunk/source/Expression/IRInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRInterpreter.cpp?rev=291198&r1=291197&r2=291198&view=diff
==============================================================================
--- lldb/trunk/source/Expression/IRInterpreter.cpp (original)
+++ lldb/trunk/source/Expression/IRInterpreter.cpp Thu Jan  5 18:38:06 2017
@@ -1602,25 +1602,23 @@ bool IRInterpreter::Interpret(llvm::Modu
           lldb::addr_t addr = tmp_op.ULongLong();
           size_t dataSize = 0;
 
-          if (execution_unit.GetAllocSize(addr, dataSize)) {
-            // Create the required buffer
-            rawArgs[i].size = dataSize;
-            rawArgs[i].data_ap.reset(new uint8_t[dataSize + 1]);
+          bool Success = execution_unit.GetAllocSize(addr, dataSize);
+          (void)Success;
+          assert(Success &&
+                 "unable to locate host data for transfer to device");
+          // Create the required buffer
+          rawArgs[i].size = dataSize;
+          rawArgs[i].data_ap.reset(new uint8_t[dataSize + 1]);
 
-            // Read string from host memory
-            execution_unit.ReadMemory(rawArgs[i].data_ap.get(), addr, dataSize,
-                                      error);
-            if (error.Fail()) {
-              assert(!"we have failed to read the string from memory");
-              return false;
-            }
-            // Add null terminator
-            rawArgs[i].data_ap[dataSize] = '\0';
-            rawArgs[i].type = lldb_private::ABI::CallArgument::HostPointer;
-          } else {
-            assert(!"unable to locate host data for transfer to device");
-            return false;
-          }
+          // Read string from host memory
+          execution_unit.ReadMemory(rawArgs[i].data_ap.get(), addr, dataSize,
+                                    error);
+          assert(!error.Fail() &&
+                 "we have failed to read the string from memory");
+
+          // Add null terminator
+          rawArgs[i].data_ap[dataSize] = '\0';
+          rawArgs[i].type = lldb_private::ABI::CallArgument::HostPointer;
         } else /* if ( arg_ty->isPointerTy() ) */
         {
           rawArgs[i].type = lldb_private::ABI::CallArgument::TargetValue;

Modified: lldb/trunk/source/Host/windows/EditLineWin.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/EditLineWin.cpp?rev=291198&r1=291197&r2=291198&view=diff
==============================================================================
--- lldb/trunk/source/Host/windows/EditLineWin.cpp (original)
+++ lldb/trunk/source/Host/windows/EditLineWin.cpp Thu Jan  5 18:38:06 2017
@@ -285,11 +285,10 @@ void el_end(EditLine *el) {
   // assert( !"Not implemented!" );
 }
 
-void el_reset(EditLine *) { assert(!"Not implemented!"); }
+void el_reset(EditLine *) { llvm_unreachable("Not implemented!"); }
 
 int el_getc(EditLine *, char *) {
-  assert(!"Not implemented!");
-  return 0;
+  llvm_unreachable("Not implemented!");
 }
 
 void el_push(EditLine *, const char *) {}
@@ -297,8 +296,7 @@ void el_push(EditLine *, const char *) {
 void el_beep(EditLine *) { Beep(1000, 500); }
 
 int el_parse(EditLine *, int, const char **) {
-  assert(!"Not implemented!");
-  return 0;
+  llvm_unreachable("Not implemented!");
 }
 
 int el_get(EditLine *el, int code, ...) {
@@ -311,7 +309,7 @@ int el_get(EditLine *el, int code, ...)
     *dout = clientData;
   } break;
   default:
-    assert(!"Not implemented!");
+    llvm_unreachable("Not implemented!");
   }
   return 0;
 }
@@ -322,7 +320,7 @@ int el_source(EditLine *el, const char *
   return 0;
 }
 
-void el_resize(EditLine *) { assert(!"Not implemented!"); }
+void el_resize(EditLine *) { llvm_unreachable("Not implemented!"); }
 
 const LineInfo *el_line(EditLine *el) { return 0; }
 
@@ -331,7 +329,7 @@ int el_insertstr(EditLine *, const char
   return 0;
 }
 
-void el_deletestr(EditLine *, int) { assert(!"Not implemented!"); }
+void el_deletestr(EditLine *, int) { llvm_unreachable("Not implemented!"); }
 
 History *history_init(void) {
   // return dummy handle

Modified: lldb/trunk/source/Interpreter/OptionValueProperties.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueProperties.cpp?rev=291198&r1=291197&r2=291198&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValueProperties.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueProperties.cpp Thu Jan  5 18:38:06 2017
@@ -584,8 +584,7 @@ Error OptionValueProperties::DumpPropert
 }
 
 lldb::OptionValueSP OptionValueProperties::DeepCopy() const {
-  assert(!"this shouldn't happen");
-  return lldb::OptionValueSP();
+  llvm_unreachable("this shouldn't happen");
 }
 
 const Property *OptionValueProperties::GetPropertyAtPath(

Modified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp?rev=291198&r1=291197&r2=291198&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp Thu Jan  5 18:38:06 2017
@@ -196,8 +196,8 @@ bool fixupX86StructRetCalls(llvm::Module
     llvm::AllocaInst *new_func_ptr =
         new llvm::AllocaInst(new_func_ptr_type, "new_func_ptr", call_inst);
     // store the new_func_cast to the newly allocated space
-    (void)new llvm::StoreInst(new_func_cast, new_func_ptr,
-                              "new_func_ptr_load_cast", call_inst);
+    (new llvm::StoreInst(new_func_cast, new_func_ptr, call_inst))
+        ->setName("new_func_ptr_load_cast");
     // load the new function address ready for a jump
     llvm::LoadInst *new_func_addr_load =
         new llvm::LoadInst(new_func_ptr, "load_func_pointer", call_inst);

Modified: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp?rev=291198&r1=291197&r2=291198&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp Thu Jan  5 18:38:06 2017
@@ -480,8 +480,7 @@ Error ProcessKDP::DoResume() {
 
     default:
       // The only valid thread resume states are listed above
-      assert(!"invalid thread resume state");
-      break;
+      llvm_unreachable("invalid thread resume state");
     }
   }
 

Modified: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp?rev=291198&r1=291197&r2=291198&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp Thu Jan  5 18:38:06 2017
@@ -116,8 +116,7 @@ ThreadKDP::CreateRegisterContextForFrame
             new RegisterContextKDP_x86_64(*this, concrete_frame_idx));
         break;
       default:
-        assert(!"Add CPU type support in KDP");
-        break;
+        llvm_unreachable("Add CPU type support in KDP");
       }
     }
   } else {

Modified: lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp?rev=291198&r1=291197&r2=291198&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp Thu Jan  5 18:38:06 2017
@@ -167,7 +167,7 @@ DynamicRegisterInfo::SetRegisterInfo(con
                       reg_info.byte_offset =
                           containing_reg_info->byte_offset + msbyte;
                     } else {
-                      assert(!"Invalid byte order");
+                      llvm_unreachable("Invalid byte order");
                     }
                   } else {
                     if (msbit > max_bit)

Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp?rev=291198&r1=291197&r2=291198&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp Thu Jan  5 18:38:06 2017
@@ -1053,8 +1053,7 @@ bool RegisterContextLLDB::ReadRegisterVa
   case UnwindLLDB::RegisterLocation::eRegisterNotSaved:
     break;
   case UnwindLLDB::RegisterLocation::eRegisterSavedAtHostMemoryLocation:
-    assert("FIXME debugger inferior function call unwind");
-    break;
+    llvm_unreachable("FIXME debugger inferior function call unwind");
   case UnwindLLDB::RegisterLocation::eRegisterSavedAtMemoryLocation: {
     Error error(ReadRegisterValueFromMemory(
         reg_info, regloc.location.target_memory_location, reg_info->byte_size,
@@ -1062,8 +1061,7 @@ bool RegisterContextLLDB::ReadRegisterVa
     success = error.Success();
   } break;
   default:
-    assert("Unknown RegisterLocation type.");
-    break;
+    llvm_unreachable("Unknown RegisterLocation type.");
   }
   return success;
 }
@@ -1097,8 +1095,7 @@ bool RegisterContextLLDB::WriteRegisterV
   case UnwindLLDB::RegisterLocation::eRegisterNotSaved:
     break;
   case UnwindLLDB::RegisterLocation::eRegisterSavedAtHostMemoryLocation:
-    assert("FIXME debugger inferior function call unwind");
-    break;
+    llvm_unreachable("FIXME debugger inferior function call unwind");
   case UnwindLLDB::RegisterLocation::eRegisterSavedAtMemoryLocation: {
     Error error(WriteRegisterValueToMemory(
         reg_info, regloc.location.target_memory_location, reg_info->byte_size,
@@ -1106,8 +1103,7 @@ bool RegisterContextLLDB::WriteRegisterV
     success = error.Success();
   } break;
   default:
-    assert("Unknown RegisterLocation type.");
-    break;
+    llvm_unreachable("Unknown RegisterLocation type.");
   }
   return success;
 }

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=291198&r1=291197&r2=291198&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp Thu Jan  5 18:38:06 2017
@@ -2599,10 +2599,7 @@ size_t GDBRemoteCommunicationClient::Get
       thread_ids.push_back(1);
     }
   } else {
-#if defined(LLDB_CONFIGURATION_DEBUG)
-// assert(!"ProcessGDBRemote::UpdateThreadList() failed due to not getting the
-// sequence mutex");
-#else
+#if !defined(LLDB_CONFIGURATION_DEBUG)
     Log *log(ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet(GDBR_LOG_PROCESS |
                                                            GDBR_LOG_PACKETS));
     if (log)

Modified: lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp?rev=291198&r1=291197&r2=291198&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp (original)
+++ lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp Thu Jan  5 18:38:06 2017
@@ -1599,12 +1599,7 @@ StructuredData::ArraySP ScriptInterprete
 // as the underlying typedef for uint* types, size_t, off_t and other values
 // change.
 
-template <typename T> const char *GetPythonValueFormatString(T t) {
-  assert(!"Unhandled type passed to GetPythonValueFormatString(T), make a "
-          "specialization of GetPythonValueFormatString() to support this "
-          "type.");
-  return nullptr;
-}
+template <typename T> const char *GetPythonValueFormatString(T t) = delete;
 template <> const char *GetPythonValueFormatString(char *) { return "s"; }
 template <> const char *GetPythonValueFormatString(char) { return "b"; }
 template <> const char *GetPythonValueFormatString(unsigned char) {

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp?rev=291198&r1=291197&r2=291198&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp Thu Jan  5 18:38:06 2017
@@ -65,8 +65,7 @@ bool DWARFDebugRanges::Extract(SymbolFil
       break;
 
     default:
-      assert(!"DWARFRangeList::Extract() unsupported address size.");
-      break;
+      llvm_unreachable("DWARFRangeList::Extract() unsupported address size.");
     }
 
     // Filter out empty ranges

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp?rev=291198&r1=291197&r2=291198&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp Thu Jan  5 18:38:06 2017
@@ -734,12 +734,11 @@ int DWARFFormValue::Compare(const DWARFF
   }
 
   case DW_FORM_indirect:
-    assert(!"This shouldn't happen after the form has been extracted...");
-    break;
+    llvm_unreachable(
+        "This shouldn't happen after the form has been extracted...");
 
   default:
-    assert(!"Unhandled DW_FORM");
-    break;
+    llvm_unreachable("Unhandled DW_FORM");
   }
   return -1;
 }

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp?rev=291198&r1=291197&r2=291198&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp Thu Jan  5 18:38:06 2017
@@ -167,8 +167,7 @@ void DWARFMappedHash::Prologue::AppendAt
   case DW_FORM_exprloc:
   case DW_FORM_flag_present:
   case DW_FORM_ref_sig8:
-    assert(!"Unhandled atom form");
-    break;
+    llvm_unreachable("Unhandled atom form");
 
   case DW_FORM_string:
   case DW_FORM_block:

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp?rev=291198&r1=291197&r2=291198&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp Thu Jan  5 18:38:06 2017
@@ -1253,8 +1253,7 @@ SymbolFileDWARFDebugMap::GetCompileUnit(
       }
     }
   }
-  assert(!"this shouldn't happen");
-  return lldb::CompUnitSP();
+  llvm_unreachable("this shouldn't happen");
 }
 
 SymbolFileDWARFDebugMap::CompileUnitInfo *

Modified: lldb/trunk/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp?rev=291198&r1=291197&r2=291198&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp (original)
+++ lldb/trunk/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp Thu Jan  5 18:38:06 2017
@@ -442,15 +442,14 @@ size_t UnwindAssemblyInstEmulation::Writ
   case EmulateInstruction::eContextPushRegisterOnStack: {
     uint32_t reg_num = LLDB_INVALID_REGNUM;
     uint32_t generic_regnum = LLDB_INVALID_REGNUM;
-    if (context.info_type ==
-        EmulateInstruction::eInfoTypeRegisterToRegisterPlusOffset) {
-      const uint32_t unwind_reg_kind = m_unwind_plan_ptr->GetRegisterKind();
-      reg_num = context.info.RegisterToRegisterPlusOffset.data_reg
-                    .kinds[unwind_reg_kind];
-      generic_regnum = context.info.RegisterToRegisterPlusOffset.data_reg
-                           .kinds[eRegisterKindGeneric];
-    } else
-      assert(!"unhandled case, add code to handle this!");
+    assert(context.info_type ==
+               EmulateInstruction::eInfoTypeRegisterToRegisterPlusOffset &&
+           "unhandled case, add code to handle this!");
+    const uint32_t unwind_reg_kind = m_unwind_plan_ptr->GetRegisterKind();
+    reg_num = context.info.RegisterToRegisterPlusOffset.data_reg
+                  .kinds[unwind_reg_kind];
+    generic_regnum = context.info.RegisterToRegisterPlusOffset.data_reg
+                         .kinds[eRegisterKindGeneric];
 
     if (reg_num != LLDB_INVALID_REGNUM &&
         generic_regnum != LLDB_REGNUM_GENERIC_SP) {

Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=291198&r1=291197&r2=291198&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Thu Jan  5 18:38:06 2017
@@ -390,7 +390,7 @@ static void ParseLangArgs(LangOptions &O
     case IK_AST:
     case IK_LLVM_IR:
     case IK_RenderScript:
-      assert(!"Invalid input kind!");
+      llvm_unreachable("Invalid input kind!");
     case IK_OpenCL:
       LangStd = LangStandard::lang_opencl;
       break;
@@ -7568,8 +7568,7 @@ ClangASTContext::GetTemplateArgument(lld
             return CompilerType();
 
           default:
-            assert(!"Unhandled clang::TemplateArgument::ArgKind");
-            break;
+            llvm_unreachable("Unhandled clang::TemplateArgument::ArgKind");
           }
         }
       }

Modified: lldb/trunk/source/Symbol/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Type.cpp?rev=291198&r1=291197&r2=291198&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Type.cpp (original)
+++ lldb/trunk/source/Symbol/Type.cpp Thu Jan  5 18:38:06 2017
@@ -484,8 +484,7 @@ bool Type::ResolveClangType(ResolveState
         break;
 
       default:
-        assert(!"Unhandled encoding_data_type.");
-        break;
+        llvm_unreachable("Unhandled encoding_data_type.");
       }
     } else {
       // We have no encoding type, return void?
@@ -529,8 +528,7 @@ bool Type::ResolveClangType(ResolveState
         break;
 
       default:
-        assert(!"Unhandled encoding_data_type.");
-        break;
+        llvm_unreachable("Unhandled encoding_data_type.");
       }
     }
 

Modified: lldb/trunk/source/Target/ABI.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ABI.cpp?rev=291198&r1=291197&r2=291198&view=diff
==============================================================================
--- lldb/trunk/source/Target/ABI.cpp (original)
+++ lldb/trunk/source/Target/ABI.cpp Thu Jan  5 18:38:06 2017
@@ -189,8 +189,7 @@ bool ABI::PrepareTrivialCall(Thread &thr
                              lldb::addr_t returnAddress, llvm::Type &returntype,
                              llvm::ArrayRef<ABI::CallArgument> args) const {
   // dummy prepare trivial call
-  assert(!"Should never get here!");
-  return false;
+  llvm_unreachable("Should never get here!");
 }
 
 bool ABI::GetFallbackRegisterLocation(

Modified: lldb/trunk/source/Target/Platform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Platform.cpp?rev=291198&r1=291197&r2=291198&view=diff
==============================================================================
--- lldb/trunk/source/Target/Platform.cpp (original)
+++ lldb/trunk/source/Target/Platform.cpp Thu Jan  5 18:38:06 2017
@@ -1876,9 +1876,8 @@ size_t Platform::GetSoftwareBreakpointTr
   } break;
 
   default:
-    assert(
-        !"Unhandled architecture in Platform::GetSoftwareBreakpointTrapOpcode");
-    break;
+    llvm_unreachable(
+        "Unhandled architecture in Platform::GetSoftwareBreakpointTrapOpcode");
   }
 
   assert(bp_site);

Modified: lldb/trunk/source/Target/StackFrameList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StackFrameList.cpp?rev=291198&r1=291197&r2=291198&view=diff
==============================================================================
--- lldb/trunk/source/Target/StackFrameList.cpp (original)
+++ lldb/trunk/source/Target/StackFrameList.cpp Thu Jan  5 18:38:06 2017
@@ -541,8 +541,7 @@ StackFrameSP StackFrameList::GetFrameAtI
     if (m_frames.empty()) {
       // Why do we have a thread with zero frames, that should not ever
       // happen...
-      if (m_thread.IsValid())
-        assert("A valid thread has no frames.");
+      assert(!m_thread.IsValid() && "A valid thread has no frames.");
     } else {
       ResetCurrentInlinedDepth();
       frame_sp = m_frames[original_idx];

Modified: lldb/trunk/tools/debugserver/source/DNBDataRef.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/DNBDataRef.cpp?rev=291198&r1=291197&r2=291198&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/DNBDataRef.cpp (original)
+++ lldb/trunk/tools/debugserver/source/DNBDataRef.cpp Thu Jan  5 18:38:06 2017
@@ -115,18 +115,13 @@ uint32_t DNBDataRef::GetMax32(offset_t *
   switch (byte_size) {
   case 1:
     return Get8(offset_ptr);
-    break;
   case 2:
     return Get16(offset_ptr);
-    break;
   case 4:
     return Get32(offset_ptr);
-    break;
   default:
-    assert(!"GetMax32 unhandled case!");
-    break;
+    llvm_unreachable("GetMax32 unhandled case!");
   }
-  return 0;
 }
 
 //----------------------------------------------------------------------
@@ -139,21 +134,15 @@ uint64_t DNBDataRef::GetMax64(offset_t *
   switch (size) {
   case 1:
     return Get8(offset_ptr);
-    break;
   case 2:
     return Get16(offset_ptr);
-    break;
   case 4:
     return Get32(offset_ptr);
-    break;
   case 8:
     return Get64(offset_ptr);
-    break;
   default:
-    assert(!"GetMax64 unhandled case!");
-    break;
+    llvm_unreachable("GetMax64 unhandled case!");
   }
-  return 0;
 }
 
 //----------------------------------------------------------------------

Modified: lldb/trunk/tools/driver/Platform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Platform.cpp?rev=291198&r1=291197&r2=291198&view=diff
==============================================================================
--- lldb/trunk/tools/driver/Platform.cpp (original)
+++ lldb/trunk/tools/driver/Platform.cpp Thu Jan  5 18:38:06 2017
@@ -34,9 +34,8 @@ int ioctl(int d, int request, ...) {
     return 0;
   } break;
   default:
-    assert(!"Not implemented!");
+    llvm_unreachable("Not implemented!");
   }
-  return -1;
 }
 
 int kill(pid_t pid, int sig) {
@@ -44,13 +43,11 @@ int kill(pid_t pid, int sig) {
   if (pid == getpid())
     exit(sig);
   //
-  assert(!"Not implemented!");
-  return -1;
+  llvm_unreachable("Not implemented!");
 }
 
 int tcsetattr(int fd, int optional_actions, const struct termios *termios_p) {
-  assert(!"Not implemented!");
-  return -1;
+  llvm_unreachable("Not implemented!");
 }
 
 int tcgetattr(int fildes, struct termios *termios_p) {

Modified: lldb/trunk/tools/lldb-perf/lib/Results.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-perf/lib/Results.cpp?rev=291198&r1=291197&r2=291198&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-perf/lib/Results.cpp (original)
+++ lldb/trunk/tools/lldb-perf/lib/Results.cpp Thu Jan  5 18:38:06 2017
@@ -76,8 +76,7 @@ static void AddResultToArray(CFCMutableA
   } break;
 
   default:
-    assert(!"unhandled result");
-    break;
+    llvm_unreachable("unhandled result");
   }
 }
 
@@ -125,8 +124,7 @@ static void AddResultToDictionary(CFCMut
                                result->GetAsUnsigned()->GetValue(), true);
   } break;
   default:
-    assert(!"unhandled result");
-    break;
+    llvm_unreachable("unhandled result");
   }
 }
 void Results::Write(const char *out_path) {




More information about the lldb-commits mailing list