Skip to content

Commit 8db51a6

Browse files
committed
[lldb] Rename lldb_assert -> _lldb_assert (NFC)
Rename `lldb_assert` to `_lldb_assert` to make it more obvious that you shouldn't be using this function directly. Instead, you should use the `lldbassert` macro which becomes a regular assert in a debug/asserts build.
1 parent 6b3ba66 commit 8db51a6

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

lldb/include/lldb/Utility/LLDBAssert.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
#endif
3030

3131
namespace lldb_private {
32-
void lldb_assert(bool expression, const char *expr_text, const char *func,
33-
const char *file, unsigned int line);
32+
void _lldb_assert(bool expression, const char *expr_text, const char *func,
33+
const char *file, unsigned int line);
3434

3535
typedef void (*LLDBAssertCallback)(llvm::StringRef message,
3636
llvm::StringRef backtrace,

lldb/source/Utility/LLDBAssert.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
namespace lldb_private {
2222

23+
/// The default callback prints to stderr.
2324
static void DefaultAssertCallback(llvm::StringRef message,
2425
llvm::StringRef backtrace,
2526
llvm::StringRef prompt) {
@@ -31,8 +32,8 @@ static void DefaultAssertCallback(llvm::StringRef message,
3132
static std::atomic<LLDBAssertCallback> g_lldb_assert_callback =
3233
&DefaultAssertCallback;
3334

34-
void lldb_assert(bool expression, const char *expr_text, const char *func,
35-
const char *file, unsigned int line) {
35+
void _lldb_assert(bool expression, const char *expr_text, const char *func,
36+
const char *file, unsigned int line) {
3637
if (LLVM_LIKELY(expression))
3738
return;
3839

@@ -44,8 +45,6 @@ void lldb_assert(bool expression, const char *expr_text, const char *func,
4445
}
4546
#endif
4647

47-
// Print a warning and encourage the user to file a bug report, similar to
48-
// LLVM’s crash handler, and then return execution.
4948
std::string buffer;
5049
llvm::raw_string_ostream backtrace(buffer);
5150
llvm::sys::PrintStackTrace(backtrace);
@@ -54,7 +53,7 @@ void lldb_assert(bool expression, const char *expr_text, const char *func,
5453
llvm::formatv("Assertion failed: ({0}), function {1}, file {2}, line {3}",
5554
expr_text, func, file, line)
5655
.str(),
57-
buffer,
56+
backtrace.str(),
5857
"Please file a bug report against lldb reporting this failure log, and "
5958
"as many details as possible");
6059
}

0 commit comments

Comments
 (0)