[PATCH] Implemented formatting of rvalue references

Daniel Jasper djasper at google.com
Tue Mar 12 09:09:02 PDT 2013


  Looks good.


================
Comment at: lib/Format/TokenAnnotator.cpp:980
@@ -980,4 +979,3 @@
     return Left.FormatTok.Tok.isLiteral() ||
-           (Left.isNot(tok::star) && Left.isNot(tok::amp) &&
-            Left.isNot(tok::l_paren) && !Style.PointerBindsToType);
-  if (Left.is(tok::amp) || Left.is(tok::star))
+           ((Left.Type != TT_PointerOrReference) && Left.isNot(tok::l_paren) &&
+            !Style.PointerBindsToType);
----------------
No parenthesis around Left.Type != ... necessary. Same below.

================
Comment at: unittests/Format/FormatTest.cpp:1979
@@ +1978,3 @@
+  verifyFormat("int f(int a, char &&b) {}");
+  verifyGoogleFormat("int f(int a, char&& b) {}");
+
----------------
Add a test case with "int &&b = .."


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

BRANCH
  svn

ARCANIST PROJECT
  clang



More information about the cfe-commits mailing list