[PATCH] D38511: [cmake] Add LLVM_ENABLE_DEBUG variable which can be used to replace NDEBUG

Don Hinton via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 3 18:35:43 PDT 2017


hintonda added a comment.

In https://reviews.llvm.org/D38511#887435, @hintonda wrote:

> In https://reviews.llvm.org/D38511#887415, @MatzeB wrote:
>
> > Will we only use LLVM_DEBUG in the public headers or also in the implementation files and private headers?
>
>
> I'd suggest outlawing NDEBUG, but initially the problem is usage of NDEBUG in public headers.
>
> > Apart from `NDEBUG` there's also the peculiar case of `assert()`s in the headers; though they are probably less of a problem as they do not change the datastructures.


Actually, I'd like to backpeddle a bit.  It would not be appropriate to replace all instances of NDEBUG.  Also, asserts should not be affected, so any code enabled when NDEBUG is not defined should still be available when asserts are enabled.

So the goal should be to remove only debugging code in headers not required by asserts, if they are enabled.


https://reviews.llvm.org/D38511





More information about the llvm-commits mailing list