Issue 87244
Summary lldb/source/Target/Target.cpp:844: function only ever returns true ?
Labels new issue
Assignees
Reporter dcb314
    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.

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to