r181980 - Add back accidentally deleted line and add test for it.

Daniel Jasper djasper at google.com
Wed May 15 21:26:03 PDT 2013


Author: djasper
Date: Wed May 15 23:26:02 2013
New Revision: 181980

URL: http://llvm.org/viewvc/llvm-project?rev=181980&view=rev
Log:
Add back accidentally deleted line and add test for it.

Before:
f("a", "b"
  "c");
After:
f("a", "b"
       "c");

Modified:
    cfe/trunk/lib/Format/Format.cpp
    cfe/trunk/unittests/Format/FormatTest.cpp

Modified: cfe/trunk/lib/Format/Format.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=181980&r1=181979&r2=181980&view=diff
==============================================================================
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Wed May 15 23:26:02 2013
@@ -744,6 +744,7 @@ private:
       State.StartOfStringLiteral = State.Column;
     } else if (!Current.isOneOf(tok::comment, tok::identifier, tok::hash,
                                 tok::string_literal)) {
+      State.StartOfStringLiteral = 0;
     }
 
     State.Column += Current.FormatTok.TokenLength;

Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=181980&r1=181979&r2=181980&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Wed May 15 23:26:02 2013
@@ -2238,6 +2238,8 @@ TEST_F(FormatTest, AlignsStringLiterals)
   verifyFormat("a = a + \"a\"\n"
                "        \"a\"\n"
                "        \"a\";");
+  verifyFormat("f(\"a\", \"b\"\n"
+               "       \"c\");");
 
   verifyFormat(
       "#define LL_FORMAT \"ll\"\n"





More information about the cfe-commits mailing list