[all-commits] [llvm/llvm-project] c9d05f: [llvm] properly guard dump methods in Support lib ...
Andrew Rogers via All-commits
all-commits at lists.llvm.org
Wed May 14 08:54:33 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: c9d05f3bcb3df5e56c0f9fc91366d62a229e7fb9
https://github.com/llvm/llvm-project/commit/c9d05f3bcb3df5e56c0f9fc91366d62a229e7fb9
Author: Andrew Rogers <andrurogerz at gmail.com>
Date: 2025-05-14 (Wed, 14 May 2025)
Changed paths:
M llvm/include/llvm/ADT/APFixedPoint.h
M llvm/include/llvm/ADT/APFloat.h
M llvm/include/llvm/ADT/APInt.h
M llvm/include/llvm/ADT/DynamicAPInt.h
M llvm/include/llvm/ADT/SlowDynamicAPInt.h
M llvm/include/llvm/ADT/TrieRawHashMap.h
M llvm/include/llvm/ADT/Twine.h
M llvm/include/llvm/Support/BalancedPartitioning.h
M llvm/include/llvm/Support/BranchProbability.h
M llvm/include/llvm/Support/DebugCounter.h
M llvm/include/llvm/Support/KnownBits.h
M llvm/include/llvm/Support/SMTAPI.h
M llvm/include/llvm/Support/ScaledNumber.h
M llvm/lib/Support/APFixedPoint.cpp
M llvm/lib/Support/BalancedPartitioning.cpp
M llvm/lib/Support/DebugCounter.cpp
M llvm/lib/Support/DynamicAPInt.cpp
M llvm/lib/Support/KnownBits.cpp
M llvm/lib/Support/ScaledNumber.cpp
M llvm/lib/Support/SlowDynamicAPInt.cpp
M llvm/lib/Support/Z3Solver.cpp
Log Message:
-----------
[llvm] properly guard dump methods in Support lib classes (#139804)
## Purpose
Add proper preprocessor guards for all `dump()` methods in the LLVM
support library. This change ensures these methods are not part of the
public ABI for release builds.
## Overview
* Annotates all `dump` methods in Support and ADT source with the
`LLVM_DUMP_METHOD` macro.
* Conditionally includes all `dump` method definitions in Support and
ADT source so they are only present on debug/assert builds and when
`LLVM_ENABLE_DUMP` is explicitly defined.
NOTE: For many of these `dump` methods, the implementation was already
properly guarded but the declaration in the header file was not.
## Background
This issue was raised in comments on #136629. I am addressing it as a
separate change since it is independent from the changes being made in
that PR.
According to [this
documentation](https://github.com/llvm/llvm-project/blob/main/llvm/include/llvm/Support/Compiler.h#L637),
`dump` methods should be annotated with `LLVM_DUMP_METHOD` and
conditionally included as follows:
```
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
LLVM_DUMP_METHOD void dump() const;
#endif
```
## Validation
* Local release build succeeds.
* CI
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list