[PATCH] D11946: Create clang-tidy module modernize. Add pass-by-value check.

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 12 11:49:48 PDT 2015


alexfh added inline comments.

================
Comment at: clang-tidy/modernize/PassByValueCheck.cpp:158
@@ +157,3 @@
+                                     Compiler.getLangOpts(),
+                                     IncludeSorter::IS_LLVM));
+  Compiler.getPreprocessor().addPPCallbacks(Inserter->CreatePPCallbacks());
----------------
Include sorting style should be configurable. See `BracesAroundStatementsCheck` for an example.

================
Comment at: clang-tidy/modernize/PassByValueCheck.cpp:180
@@ +179,3 @@
+  // Iterate over all declarations of the constructor.
+  for (const ParmVarDecl *ParmDecl : AllParamDecls) {
+    auto ParamTL = ParmDecl->getTypeSourceInfo()->getTypeLoc();
----------------
nit: I'd remove the variable and iterate over `collectParamDecls(...)` instead.

================
Comment at: test/clang-tidy/modernize-pass-by-value.cpp:4
@@ +3,3 @@
+
+// CHiECK-FIXES: #include <utility>
+
----------------
Typo: `CHiECK-FIXES:`

================
Comment at: test/clang-tidy/modernize-pass-by-value.cpp:27
@@ +26,3 @@
+
+// Test that we aren't modifying other things than a parameter
+Movable GlobalObj;
----------------
nit: Trailing period (+ a few places below).


http://reviews.llvm.org/D11946





More information about the cfe-commits mailing list