diff options
author | Andrey Karlov <dein.negativ@gmail.com> | 2025-07-23 13:19:23 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-07-23 13:19:23 +0300 |
commit | 5de443a4d37e1b7580f9ccee389572aef7233a85 (patch) | |
tree | 0c9ac8792dee2faa7faf7773c72105db47738f55 /llvm/unittests/Testing/ADT/StringMapEntryTest.cpp | |
parent | ffdada166689172e54bd664ff3e43c824c22c69b (diff) | |
download | llvm-5de443a4d37e1b7580f9ccee389572aef7233a85.zip llvm-5de443a4d37e1b7580f9ccee389572aef7233a85.tar.gz llvm-5de443a4d37e1b7580f9ccee389572aef7233a85.tar.bz2 |
[clang-tidy] Make copy-and-swap idiom more general for `bugprone-unhandled-self-assignment` (#147066)
This change enhances the `bugprone-unhandled-self-assignment` checker by
adding an additional matcher that generalizes the copy-and-swap idiom
pattern detection.
# What Changed
Added a new matcher that checks for:
- An instance of the current class being created in operator=
(regardless of constructor arguments)
- That instance being passed to a `swap` function call
# Problem Solved
This fix reduces false positives in PMR-like scenarios where "extended"
constructors are used (typically taking an additional allocator
argument). The checker now properly recognizes copy-and-swap
implementations that use extended copy/move constructors instead of
flagging them as unhandled self-assignment cases.
Fixes #146324
---------
Co-authored-by: Baranov Victor <bar.victor.2002@gmail.com>
Diffstat (limited to 'llvm/unittests/Testing/ADT/StringMapEntryTest.cpp')
0 files changed, 0 insertions, 0 deletions