diff options
author | Andrew Rogers <andrurogerz@gmail.com> | 2025-05-14 13:48:45 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-05-14 13:48:45 -0700 |
commit | 0563186a76ddf51b8a7b6eaf0357c224f2625df8 (patch) | |
tree | c2fe62cc6f55703792bcb3ad8283691393db1ff9 /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | e24d8662e8121a22c4629071692bd114c3ff8b42 (diff) | |
download | llvm-0563186a76ddf51b8a7b6eaf0357c224f2625df8.zip llvm-0563186a76ddf51b8a7b6eaf0357c224f2625df8.tar.gz llvm-0563186a76ddf51b8a7b6eaf0357c224f2625df8.tar.bz2 |
[llvm] properly guard dump methods in Support lib classes (#139938)
## 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 PR is a redo of #139804 with some changes to fix clang and unit
test build breaks.
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
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions