search for: assert_strm

Displaying 13 results from an estimated 13 matches for "assert_strm".

2011 Jul 26
5
[LLVMdev] Proposal for better assertions in LLVM
...ertions in LLVM would be a lot more useful if they could print out not only the source code of the expression that failed, but also print the values of the various arguments. To that end, I have an idea for an improved assert macro which would use raw_ostream. It would look something like this: ASSERT_STRM(Ty == STy, "Expected " << Ty << " but got " << STy->getElementType(0)); This would transform to: if (!(Ty == STy)) AssertionFailureStream(__FILE__, __LINE__) << "Expected " << Ty << " but got " <<...
2011 Jul 27
5
[LLVMdev] Proposal for better assertions in LLVM
Here's an example of how this would be used: In the constructor for ConstantVector, there's an assert: assert(C->getType() == T->getElementType() && "Initializer for vector element doesn't match vector element type!"); I would change this to: ASSERT_STRM(C->getType() == T->getElementType(), "Initializer for vector element " << I - V.begin() << " with type " << C->getType() << " doesn't match vector element type " << T->getElementType()); With more detailed asse...
2011 Jul 26
2
[LLVMdev] Proposal for better assertions in LLVM
On Tue, Jul 26, 2011 at 10:56 AM, FlyLanguage <flylanguage at gmail.com> wrote: > #define ASSERT_STRM(cond, args) \ >> if (!(cond)) AssertionFailureStream(__FILE_**_, __LINE__) << args >> >> Note that there's no trailing semicolon, as this is supplied at the >> point where the macro is invoked. >> >> What do you think? >> > > Neat, but i...
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 (false) > >...
2011 Jul 27
0
[LLVMdev] Proposal for better assertions in LLVM
...his would be used: In the constructor for ConstantVector, there's an assert: > > assert(C->getType() == T->getElementType() && > "Initializer for vector element doesn't match vector element type!"); > > I would change this to: > > ASSERT_STRM(C->getType() == T->getElementType(), > "Initializer for vector element " << I - V.begin() << " with type " << > C->getType() << " doesn't match vector element type " << > T->getElementType()); > &gt...
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
2011 Jul 26
0
[LLVMdev] Proposal for better assertions in LLVM
> #define ASSERT_STRM(cond, args) \ > if (!(cond)) AssertionFailureStream(__FILE__, __LINE__) << args > > Note that there's no trailing semicolon, as this is supplied at the > point where the macro is invoked. > > What do you think? Neat, but inducing a debug trap is even more useful on...
2011 Jul 26
0
[LLVMdev] Proposal for better assertions in LLVM
Den 26.07.2011 20:12, skrev Talin: > On Tue, Jul 26, 2011 at 10:56 AM, FlyLanguage <flylanguage at gmail.com > <mailto:flylanguage at gmail.com>> wrote: > > #define ASSERT_STRM(cond, args) \ > if (!(cond)) AssertionFailureStream(__FILE____, __LINE__) > << args > > Note that there's no trailing semicolon, as this is supplied at the > point where the macro is invoked. > > What do you think? > &gt...
2011 Jul 27
0
[LLVMdev] Proposal for better assertions in LLVM
...a lot more useful if they could print out > not only the source code of the expression that failed, but also print the > values of the various arguments. To that end, I have an idea for an improved > assert macro which would use raw_ostream. It would look something like this: > > ASSERT_STRM(Ty == STy, "Expected " << Ty << " but got " << > STy->getElementType(0)); > Chromium (and several other Google open source projects) have a somewhat superior variant of this: http://google.com/codesearch#hfE6470xZHk/base/logging.h&exact_package=h...
2011 Jul 27
1
[LLVMdev] Proposal for better assertions in LLVM
Great suggestion - what should the !NDEBUG version look like? On Tue, Jul 26, 2011 at 8:01 PM, Nathan Jeffords <blunted2night at gmail.com>wrote: > 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 b...
2011 Jul 26
2
[LLVMdev] Proposal for better assertions in LLVM
..., 2011 at 12:12 PM, FlyLanguage <flylanguage at gmail.com> wrote: > Den 26.07.2011 20:12, skrev Talin: > >> On Tue, Jul 26, 2011 at 10:56 AM, FlyLanguage <flylanguage at gmail.com >> <mailto:flylanguage at gmail.com>**> wrote: >> >> #define ASSERT_STRM(cond, args) \ >> if (!(cond)) AssertionFailureStream(__FILE_**___, __LINE__) >> << args >> >> Note that there's no trailing semicolon, as this is supplied at the >> point where the macro is invoked. >> >> Wh...
2011 Jul 28
2
[LLVMdev] Proposal for better assertions in LLVM
...ld be used: In the constructor for > ConstantVector, there's an assert: > > assert(C->getType() == T->getElementType() && > "Initializer for vector element doesn't match vector element > type!"); > > I would change this to: > > ASSERT_STRM(C->getType() == T->getElementType(), > "Initializer for vector element " << I - V.begin() << " with type " << > C->getType() << " doesn't match vector element type " << > T->getElementType()); > >...
2011 Jul 27
3
[LLVMdev] Proposal for better assertions in LLVM
...f they could print out >> not only the source code of the expression that failed, but also print the >> values of the various arguments. To that end, I have an idea for an improved >> assert macro which would use raw_ostream. It would look something like this: >> >> ASSERT_STRM(Ty == STy, "Expected " << Ty << " but got " << >> STy->getElementType(0)); >> > > Chromium (and several other Google open source projects) have a somewhat > superior variant of this: > > > http://google.com/codesearch#hfE6470xZH...