This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] Fix false-positives in performanc-noexcept-swap
ClosedPublic

Authored by PiotrZSL on Aug 5 2023, 1:13 AM.

Details

Summary

Enforce a stricter match with the swap function signature, eliminating false-positives.

Fixes: #64303

Diff Detail

Event Timeline

PiotrZSL created this revision.Aug 5 2023, 1:13 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 5 2023, 1:13 AM
Herald added a subscriber: xazax.hun. · View Herald Transcript
PiotrZSL requested review of this revision.Aug 5 2023, 1:13 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 5 2023, 1:13 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
carlosgalvezp accepted this revision.Aug 5 2023, 8:09 AM
carlosgalvezp added inline comments.
clang-tools-extra/clang-tidy/performance/NoexceptSwapCheck.cpp
19–20

Would be good to add a small comment summarizing what signatures this block of code matches, for easier readability.

This revision is now accepted and ready to land.Aug 5 2023, 8:09 AM
PiotrZSL updated this revision to Diff 547502.Aug 5 2023, 11:01 AM

Rebase, add comments, make more strict for method (must be non-const)

carlosgalvezp added inline comments.Aug 5 2023, 11:05 PM
clang-tools-extra/clang-tidy/performance/NoexceptSwapCheck.cpp
31

Duplicate void, remove

clang-tools-extra/test/clang-tidy/checkers/performance/noexcept-swap.cpp
215

Could we also test:

friend void swap(T&, T&)?

PiotrZSL updated this revision to Diff 547526.Aug 6 2023, 1:11 AM
PiotrZSL marked 3 inline comments as done.

Fix comments + add test with friend

PiotrZSL updated this revision to Diff 547528.Aug 6 2023, 1:14 AM

Remove space

carlosgalvezp accepted this revision.Aug 6 2023, 1:44 AM