[PATCH] Fix useAuto replacing variable declaration lists containing non-initialized variables.

Edwin Vane edwin.vane at intel.com
Thu May 16 13:58:09 PDT 2013


  Few small things.


================
Comment at: cpp11-migrate/UseAuto/UseAuto.cpp:43
@@ -42,3 +42,3 @@
 
-  Finder.addMatcher(makeIteratorDeclMatcher(), &ReplaceIterators);
+  Finder.addMatcher(makeDeclStatmentMatcher(), &ReplaceIterators);
   Finder.addMatcher(makeDeclWithNewMatcher(), &ReplaceNew);
----------------
Please keep this name the same. We're still matching iterator declarations.

================
Comment at: cpp11-migrate/UseAuto/UseAutoMatchers.cpp:160
@@ -159,2 +159,3 @@
 
+
 } // namespace ast_matchers
----------------
Can remove this extra blank line.

================
Comment at: cpp11-migrate/UseAuto/UseAutoMatchers.cpp:238
@@ +237,3 @@
+  return declStmt(
+    has(varDecl()),
+    unless(
----------------
What's the purpose of this part?

================
Comment at: cpp11-migrate/UseAuto/UseAutoMatchers.cpp:239
@@ +238,3 @@
+    has(varDecl()),
+    unless(
+      has(
----------------
I know there's not really any guidelines for indenting these matchers but since `unless` has only one child, I'd join `unless(has(varDecl(` all on one line.

================
Comment at: cpp11-migrate/UseAuto/UseAutoMatchers.cpp:245
@@ +244,3 @@
+            hasType(autoType()),
+            unless(
+              hasType(
----------------
Here too: `unless(hasType(`.

================
Comment at: test/cpp11-migrate/UseAuto/iterator.cpp:164
@@ -159,2 +163,3 @@
+  }
   return 0;
 }
----------------
Can we have a positive test too?

  std::vector<int>::iterator I = Vec.begin(), E = Vec.end();



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



More information about the cfe-commits mailing list