Skip to content

Commit

Permalink
[lldb/Utility] Use assert instead of llvm_unreachable for LLDBAssert
Browse files Browse the repository at this point in the history
llvm_unreachable is marked noreturn so the compiler can assume the code
for printing the error message in release builds isn't hit which defeats
the purpose.
  • Loading branch information
JDevlieghere committed Jan 14, 2020
1 parent c8a14c2 commit fd19ffc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lldb/source/Utility/LLDBAssert.cpp
Expand Up @@ -21,10 +21,10 @@ void lldb_private::lldb_assert(bool expression, const char *expr_text,
if (LLVM_LIKELY(expression))
return;

// In a Debug configuration lldb_assert() behaves like assert(0).
llvm_unreachable("lldb_assert failed");
// If asserts are enabled abort here.
assert(false && "lldb_assert failed");

// In a Release configuration it will print a warning and encourage the user
// In a release configuration it will print a warning and encourage the user
// to file a bug report, similar to LLVM’s crash handler, and then return
// execution.
errs() << format("Assertion failed: (%s), function %s, file %s, line %u\n",
Expand Down

0 comments on commit fd19ffc

Please sign in to comment.