[PATCH] D38406: [dump] Remove NDEBUG from test to enable dump methods [NFC]

Don Hinton via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 29 10:51:42 PDT 2017


hintonda added a comment.

While `#ifdef LLVM_ENABLE_DUMP` is arguably better than `#ifndef NDEBUG`, it's still problematic if we extend this to declarations in headers.  Some headers that declare `void dump() const`, don't include any headers, so they won't `#ifdef` away the declaration which would have helped catch the problem at compile-time.

To fix this, we could test for a value instead of just definition, i.e., `#if LLVM_ENABLE_DUMP`, or even `#if LLVM_ENABLE_DUMP > [some value]`.

That way, we are guaranteed to get a compile-time error.


https://reviews.llvm.org/D38406





More information about the llvm-commits mailing list