[PATCH] D22220: [clang-tidy] Add check 'misc-move-forwarding-reference'

Samuel Benzaquen via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 28 13:10:46 PDT 2016


sbenza added inline comments.

================
Comment at: clang-tidy/misc/MoveForwardingReferenceCheck.cpp:93
@@ +92,3 @@
+               hasArgument(0, ignoringParenImpCasts(declRefExpr(
+                                  to(ForwardingReferenceParmMatcher)))))
+          .bind("call-move"),
----------------
aaron.ballman wrote:
> I wonder if there's a reason for this behavior, or if it's simple a matter of not being needed previously and so it was never implemented. @sbenza or @klimek may know. I think we should be fixing the RecursiveASTVisitor, unless there is a valid reason not to (which there may be), though that would be a separate patch (and can happen after we land this one).
Even if the nodes are not visited through the recursive visitor, you can always have a matcher for it.
Eg: `hasAnyConstructorInitializer` / `cxxCtorInitializer`.

But what node are you trying to visit here?
The only node I see is `NamingClass`, which is not really a child node.
Like the referred `Decl` in a `DeclRefExpr` is not a child either. You can't use `has()` there, you have to use `to()`.


https://reviews.llvm.org/D22220





More information about the cfe-commits mailing list