[clang] [llvm] [llvm] properly guard dump methods in Support lib classes (PR #139938)

Harald van Dijk via cfe-commits cfe-commits at lists.llvm.org
Mon May 19 08:46:57 PDT 2025


hvdijk wrote:

Specifically here, `ScaledNumber` is a class template, that's what is causing it to be emitted in every translation unit that uses `ScaledNumber<uint64_t>`, even user code that isn't otherwise using it, and it's being emitted according to the then-current definition of `NDEBUG`.

> The issue is that we must only guard dump methods (that have definitions outside of the header) if they are not referenced in a public header, even if that reference is also guarded.

That would avoid the error, so that would be a big improvement, thanks. From a user perspective, I think it's better if we make sure declarations of `dump()` are never available if the definitions are not available, but that is a bigger change, I'd happily accept a quick fix first, and I should be able to work on that bigger change afterwards.

https://github.com/llvm/llvm-project/pull/139938


More information about the cfe-commits mailing list