mirror of
https://github.com/intel/llvm.git
synced 2026-01-14 03:50:17 +08:00
Summary: This changes lldb_assert to accept bool expressions as the parameter, this is because some objects (such as std::shared_ptr) are convertible to bool, but are not convertible to int, which leads to surprising errors. Reviewers: granata.enrico, zturner Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D9565 llvm-svn: 236819
37 lines
1.2 KiB
C++
37 lines
1.2 KiB
C++
//===--------------------- LLDBAssert.cpp --------------------------*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "lldb/Utility/LLDBAssert.h"
|
|
|
|
#include "llvm/Support/Format.h"
|
|
#include "llvm/Support/raw_ostream.h"
|
|
#include "llvm/Support/Signals.h"
|
|
|
|
using namespace llvm;
|
|
using namespace lldb_private;
|
|
|
|
void
|
|
lldb_private::lldb_assert (bool expression,
|
|
const char* expr_text,
|
|
const char* func,
|
|
const char* file,
|
|
unsigned int line)
|
|
{
|
|
if (expression)
|
|
;
|
|
else
|
|
{
|
|
errs() << format("Assertion failed: (%s), function %s, file %s, line %u\n",
|
|
expr_text, func, file, line);
|
|
errs() << "backtrace leading to the failure:\n";
|
|
llvm::sys::PrintStackTrace(errs());
|
|
errs() << "please file a bug report against lldb reporting this failure log, and as many details as possible\n";
|
|
}
|
|
}
|