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

Samuel Benzaquen via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 25 14:17:07 PDT 2016


sbenza added inline comments.

================
Comment at: clang-tidy/misc/MoveForwardingReferenceCheck.cpp:20
@@ +19,3 @@
+
+static void ReplaceMoveWithForward(const UnresolvedLookupExpr *Callee,
+                                   const TemplateTypeParmType *TypeParmType,
----------------
aaron.ballman wrote:
> Might as well pass `Context` by const reference rather than pointer.
Function names start in lower case.

================
Comment at: clang-tidy/misc/MoveForwardingReferenceCheck.cpp:30
@@ +29,3 @@
+          Callee->getLocStart(),
+          Lexer::getLocForEndOfToken(Callee->getLocEnd(), 0, SM, LangOpts)),
+      SM, LangOpts);
----------------
Isn't this just `CharSourceRange::getTokenRange(Callee->getLocStart(),Callee->getLocEnd())` ?

================
Comment at: clang-tidy/misc/MoveForwardingReferenceCheck.cpp:83
@@ +82,3 @@
+          // same function...
+          references(templateTypeParmType(hasDeclaration(hasDeclContext(
+                                              functionDecl().bind("context"))))
----------------
Will this trigger on code like this:


```
template <typename T>
void F(T);

void G() { F<string&&>(std::move(str)); }
```


https://reviews.llvm.org/D22220





More information about the cfe-commits mailing list