[PATCH] Clang-Modernize.Pass-By-Value: Fix removing of namespace in parameter type

Edwin Vane edwin.vane at intel.com
Thu Sep 5 08:11:19 PDT 2013



================
Comment at: clang-modernize/PassByValue/PassByValueActions.cpp:143-146
@@ -137,2 +142,6 @@
     //  ~~~~~~~~~~~           ~~~^
-    ValueStr += ' ';
+    SourceLocation NextChar =
+        Lexer::getLocForEndOfToken(ParamTL.getEndLoc(), 0, SM, LangOptions());
+    if (isIdentifierHead(*FullSourceLoc(NextChar, SM).getCharacterData()))
+      ValueStr += ' ';
+
----------------
Is all this extra work really necessary? Can't we rely on formatting to fix whitespace problems?

================
Comment at: test/clang-modernize/PassByValue/removing_const_fail.cpp:10
@@ +9,3 @@
+struct A {
+  A(Movable const M) : M(M) {}
+  // CHECK: A(Movable M) : M(std::move(M)) {}
----------------
Why should this be transformed? It's not being passed by const reference.


http://llvm-reviews.chandlerc.com/D1600



More information about the cfe-commits mailing list