<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/87244>87244</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            lldb/source/Target/Target.cpp:844: function only ever returns true ?
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          dcb314
      </td>
    </tr>
</table>

<pre>
    Static analyser cppcheck says:

lldb/source/Target/Target.cpp:844:42: warning: Identical condition '!num_supported_hardware_watchpoints', second condition is always false [identicalConditionAfterEarlyExit]
  if (num_supported_hardware_watchpoints == 0) {
 ^

Source code is

 // If unable to determine the # of watchpoints available,
  // assume they are supported.
  if (!num_supported_hardware_watchpoints)
    return true;

  if (num_supported_hardware_watchpoints == 0) {
 error.SetErrorStringWithFormat(
        "Target supports (%u) hardware watchpoint slots.\n",
        *num_supported_hardware_watchpoints);
 return false;
  }
  return true;

The second if can never be true, so the function only ever returns true.
Suggest code rework.

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVE2PozgQ_TXFpTQIDCRw4JAvpDlnpD22jF2Adxwb2aaz-fcrSEinD6vu1eQQLFyvXr3nh7n3qjdENRR7KI4Rn8JgXS1Fm6V51Fp5q8-BByWQG65vnhyKcRQDid_o-c1DtoPkCMnjX2vZAmu8nZwgYM0v7noKz0UsxhGyXZnnkO1yBtkOr9wZZfp5-VOSCUpwjcIaqYKyBoFtgaVmurz5aRytCyTfBu7klTt6u_IghtEqE_xSd0BPM_QFrzxyfeU3jx3XnhCKvVppDmvVrgvkTtzp2-kfFaA43sUgqg6BlV-zI2RHyI6YAKsQtvsHHorTqznnxRUUVhIq_7qDwBpgDf7scDK81YTBoqRA7qIMYRgIgWVoO3wl5e9c6bka2GGd-NGIez9dFuANuSN8jh9_lvZNb6sVhegoTM5gcBNBtv8k4k_tIuesi88UTvPiHJwy_V8qDI11Fx7maZ9TzD9g7J6qVZ2_Kyqmue3K--IYem2Dj6E4GGDsxbS13-57XqyyVy-WZH28Rdg-A_Tfbv0aaE2r6lBwg4beyWFL9-o5zHY5-W4yYsmyNfqGS9G9rV8qHyd6nvqefLiny9HVut-PnUjWmayyikdUp9s0rco82eTRUCdZ0fFCdJLkpkxK6kqRJqwsu6JokypLI1WzhOVJnqRpkWzzPN7ITvJ2UzC5bSmvKsgTunClY63fL7F1faS8n6gutyzPI81b0n65WRgzdMVlc7a-OEaunjE_2qn3kCda-eA_ugQVNNX_5zL5yiWErIkmp-shhHG5tZYPpVdhmNpY2AuwZqZ_PH6Mzv5NYiZbhvbAmkXUvwEAAP__NEyqxA">