[PATCH] D98034: [clang-tidy] Use-after-move: Ignore moves inside a try_emplace.

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 5 06:04:34 PST 2021


njames93 requested changes to this revision.
njames93 added a comment.
This revision now requires changes to proceed.

While `try_emplace` is a special case, it's may not be the only special case in someone's codebase, this should be behind extended with options to let users handle their special containers.



================
Comment at: clang-tools-extra/clang-tidy/bugprone/UseAfterMoveCheck.cpp:406
+               // the bool.
+               unless(hasParent(cxxMemberCallExpr(
+                   callee(cxxMethodDecl(hasName("try_emplace")))))))
----------------
Going with a custom list of bad names I'd suggest matching on function decls instead of method decls. 


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98034/new/

https://reviews.llvm.org/D98034



More information about the cfe-commits mailing list