[PATCH] D107450: [clang-tidy] Fix wrong FixIt in performance-move-const-arg
gehry via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 7 01:21:09 PST 2022
Sockke added inline comments.
================
Comment at: clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp:161
+ // Generate notes for an invocation with an rvalue reference parameter.
+ const auto *ReceivingCallExpr = dyn_cast<CallExpr>(ReceivingExpr);
+ const auto *ReceivingConstructExpr =
----------------
`ReceivingExpr` is not null if `IsRVRefParam` is true.
================
Comment at: clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp:165
+ // Skipping the invocation which is a template instantiation.
+ if ((!ReceivingCallExpr || !ReceivingCallExpr->getDirectCallee() ||
+ ReceivingCallExpr->getDirectCallee()->isTemplateInstantiation()) &&
----------------
Add a check for `getDirectCallee()`.
================
Comment at: clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp:175
+ ReceivingCallExpr
+ ? ReceivingCallExpr->getDirectCallee()->getUnderlyingDecl()
+ : ReceivingConstructExpr->getConstructor()->getUnderlyingDecl();
----------------
I have added a check for `getDirectCallee` before here.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D107450/new/
https://reviews.llvm.org/D107450
More information about the cfe-commits
mailing list