[Lldb-commits] [lldb] r319596 - Fix warnings in JSON.cpp, NFC

Davide Italiano via lldb-commits lldb-commits at lists.llvm.org
Fri Dec 1 15:35:38 PST 2017


Also, FWIW, this is blatantly not the correct way of using assertions.
It should either be assert(false && "patatino") or the more canonical
llvm_unreachable("patatino").
Relying on the implicit conversion from string to bool seems risky
(and not really useful).

On Fri, Dec 1, 2017 at 3:29 PM, Vedant Kumar via lldb-commits
<lldb-commits at lists.llvm.org> wrote:
> Author: vedantk
> Date: Fri Dec  1 15:29:04 2017
> New Revision: 319596
>
> URL: http://llvm.org/viewvc/llvm-project?rev=319596&view=rev
> Log:
> Fix warnings in JSON.cpp, NFC
>
> These asserts are no-ops, and are supplanted by -Wcovered-switch.
>
> Modified:
>     lldb/trunk/tools/debugserver/source/JSON.cpp
>
> Modified: lldb/trunk/tools/debugserver/source/JSON.cpp
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/JSON.cpp?rev=319596&r1=319595&r2=319596&view=diff
> ==============================================================================
> --- lldb/trunk/tools/debugserver/source/JSON.cpp (original)
> +++ lldb/trunk/tools/debugserver/source/JSON.cpp Fri Dec  1 15:29:04 2017
> @@ -58,7 +58,6 @@ uint64_t JSONNumber::GetAsUnsigned() con
>    case DataType::Double:
>      return (uint64_t)m_data.m_double;
>    }
> -  assert("Unhandled data type");
>  }
>
>  int64_t JSONNumber::GetAsSigned() const {
> @@ -70,7 +69,6 @@ int64_t JSONNumber::GetAsSigned() const
>    case DataType::Double:
>      return (int64_t)m_data.m_double;
>    }
> -  assert("Unhandled data type");
>  }
>
>  double JSONNumber::GetAsDouble() const {
> @@ -82,7 +80,6 @@ double JSONNumber::GetAsDouble() const {
>    case DataType::Double:
>      return m_data.m_double;
>    }
> -  assert("Unhandled data type");
>  }
>
>  void JSONNumber::Write(std::ostream &s) {
>
>
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


More information about the lldb-commits mailing list