[PATCH] D11833: s/NDEBUG/LLVM_NDEBUG/ in most places
Michael Kruse via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 14 08:43:47 PST 2019
Meinersbur added a comment.
`s/NDEBUG/LLVM_NDEBUG/` will not apply to the use of `NDEBUG` in `assert.h`. Most uses of `NDEBUG` are hidden in the `assert` macro.
In the aforementioned use of `NDEBUG`:
#ifndef NDEBUG
for (Loop *NewL : NewChildLoops)
assert(NewL->getParentLoop() == CurrentL && "All of the new loops must "
"be immediate children of "
"the current loop!");
#endif
it is used only to avoid the overhead of iteration when the `assert` macro expands to nothing.
Consequences:
1. Even with LLVM_NDEBUG defined, plain `assert`'s will still be evaluated.
2. To have complete asserts build, LLVM_NDEBUG and NDEBUG must be defined at the same time.
3. NDEBUG and assert are linked by the C/C++ language <https://en.cppreference.com/w/c/error/assert>. To unlink, we must also introduce `llvm_assert` (or ban `assert` in headers).
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D11833/new/
https://reviews.llvm.org/D11833
More information about the llvm-commits
mailing list