[PATCH] D21223: [clang-tidy] misc-move-const-arg: Detect if result of std::move() is being passed as a const ref argument

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 10 08:18:17 PDT 2016


aaron.ballman added a subscriber: aaron.ballman.
aaron.ballman added a reviewer: aaron.ballman.

================
Comment at: clang-tidy/misc/MoveConstantArgumentCheck.cpp:20
@@ -19,1 +19,3 @@
 
+namespace {
+
----------------
Instead of an unnamed namespace, you should use static functions per our coding standards (http://llvm.org/docs/CodingStandards.html#anonymous-namespaces).

================
Comment at: clang-tidy/misc/MoveConstantArgumentCheck.cpp:22
@@ +21,3 @@
+
+void ReplaceCallWithArg(const CallExpr *TheCallExpr, DiagnosticBuilder *Diag,
+                        const SourceManager &SM, const LangOptions &LangOpts) {
----------------
Should pass `Diag` by reference rather than by pointer.

================
Comment at: clang-tidy/misc/MoveConstantArgumentCheck.cpp:26
@@ +25,3 @@
+
+  auto BeforeArgumentsRange = Lexer::makeFileCharRange(
+      CharSourceRange::getCharRange(TheCallExpr->getLocStart(),
----------------
Should only use `auto` when the type is explicitly spelled out in the initialization (which this is not). Same elsewhere.


http://reviews.llvm.org/D21223





More information about the cfe-commits mailing list