Displaying 2 results from an estimated 2 matches for "returnsapointer".
2020 Apr 09
2
[RFC] Usage of NDEBUG as a guard for non-assert debug code
...> LLVM_VERIFY(expr, msg)
>
>
>
> The first one is useful as a traditional assert. The second one is
> useful if you are calling a function, and want to assert that it succeeds,
> but still need it to be evaluated in release builds:
>
>
>
> auto *Foo = LLVM_VERIFY(ReturnsAPointerThatShouldNeverActuallyBeNull(),
> “this should never return null”);
>
This seems fairly orthogonal to the rest of this discussion, to me at least
- it's an improvement over the existing/common:
auto *Foo = ReturnsAPointer...;
assert(Foo && "this should never be null");...
2020 Apr 09
7
[RFC] Usage of NDEBUG as a guard for non-assert debug code
Hi all,
During discussions about assertions in the Flang project, we noticed that there are a lot of cases in LLVM that #ifndef NDEBUG is used as a guard for non-assert code that we want enabled in debug builds.
This works fine on its own, however it affects the behaviour of LLVM_ENABLE_ASSERTIONS; since NDEBUG controls whether assertions are enabled or not, a lot of debug code gets enabled in