[PATCH] D12031: Const std::move() argument ClangTidy check

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 25 07:12:38 PST 2015


alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.

Awesome! Thank you for the new check!

There are a couple of nits, but I'll fix these before submitting the patch.


================
Comment at: clang-tidy/misc/MoveConstantArgumentCheck.cpp:42
@@ +41,3 @@
+    auto MoveRange = CharSourceRange::getCharRange(CallMove->getSourceRange());
+    auto FileMoveRange = Lexer::makeFileCharRange(MoveRange, SM, getLangOpts());
+    if (!FileMoveRange.isValid()) {
----------------
s/auto/CharSourceRange/

================
Comment at: clang-tidy/misc/MoveConstantArgumentCheck.cpp:47
@@ +46,3 @@
+    bool IsVariable = isa<DeclRefExpr>(Arg);
+    DiagnosticBuilder DB =
+        diag(FileMoveRange.getBegin(), "std::move of the %select{|const }0"
----------------
I'd replace `DiagnosticBuilder DB` with `auto Diag` - this is more a local convention, not a general rule.

================
Comment at: clang-tidy/misc/MoveConstantArgumentCheck.cpp:57
@@ +56,3 @@
+                                      Arg->getLocStart()),
+        SM, getLangOpts());
+    CharSourceRange AfterArgumentsRange = Lexer::makeFileCharRange(
----------------
This can probably happen when `Arg` comes from another macro (or a macro argument). A test can be added later.


http://reviews.llvm.org/D12031





More information about the cfe-commits mailing list