Displaying 3 results from an estimated 3 matches for "assertion_prologue".
2011 Jul 27
5
[LLVMdev] Proposal for better assertions in LLVM
...nvert them to string form.
Based on the suggestions so far, I'm guessing that the macro would look like
this:
#include "llvm/Support/raw_ostream.h"
namespace llvm {
// This just writes out "Assertion Failed" and the file/line number in
// a form that IDEs can parse.
void assertion_prologue(const char * file, unsigned line);
// This does the trap or abort or whatever.
void assertion_trap();
#if NDEBUG
#define LLVM_ASSERT_STRM(expr, args) do {} while false
// Alternatively
// #define LLVM_ASSERT_STRM(expr, args) (void)0
#else
/// Assertion macro that acts as an error output...
2011 Jul 27
0
[LLVMdev] Proposal for better assertions in LLVM
sorry, my previous message got sent too early
I think the macro should look something like this:
#define ASSERT_STRM(cond,expr) \
do {
if (cond) {
std::cerr << expr << std::end;
assertion_trap ();
}
} while (false)
On Tue, Jul 26, 2011 at 7:57 PM, Nathan Jeffords <blunted2night at gmail.com>wrote:
> wrapping the macro's body in:
>
> do { ... } while
2011 Jul 27
3
[LLVMdev] Proposal for better assertions in LLVM
wrapping the macro's body in:
do { ... } while (false)
would make the the macro a proper statement so that:
if (cond)
ASSERT(some_other_cond);
else
do_something_cool ();
compiles as expected.
IMO, it would work as such
#define ASSERT_STM(cond,expr)
On Tue, Jul 26, 2011 at 6:36 PM, Reid Kleckner <reid.kleckner at gmail.com>wrote:
> He wants to be able to resume execution