feat(tidy): add fairmq-bugprone-use-after-send

- Report uses of a MessagePtr after a Send() whose result is discarded.
  After the send the message is empty with zeromq, and still points to
  the sent buffer with shmem, so the same code acts differently per
  transport.
- Walk the CFG from the send with ExprSequence, like
  bugprone-use-after-move. A loop back to the send counts as a use.
- Assignment, reset(), Rebuild(), a new declaration in a loop and
  passing by non-const reference (e.g. to Receive()) give a new message.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Claude
2026-11-09 23:14:01 +00:00
parent 3b3446bfcb
commit e9afe76155
6 changed files with 309 additions and 0 deletions

View File

@@ -51,6 +51,8 @@ add_library(fairmq-tidy-module OBJECT
Transfer.h
UncheckedTransferResultCheck.cxx
UncheckedTransferResultCheck.h
UseAfterSendCheck.cxx
UseAfterSendCheck.h
)
target_compile_features(fairmq-tidy-module PUBLIC cxx_std_17)
target_include_directories(fairmq-tidy-module