]> granicus.if.org Git - clang/commitdiff
Fix regression in string literal alignment.
authorManuel Klimek <klimek@google.com>
Wed, 20 Feb 2013 15:32:58 +0000 (15:32 +0000)
committerManuel Klimek <klimek@google.com>
Wed, 20 Feb 2013 15:32:58 +0000 (15:32 +0000)
Now correctly indents (again):
a = a + "a"
        "a"
        "a";

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175630 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Format/Format.cpp
unittests/Format/FormatTest.cpp

index aca5d36aefc822c831de5bf55af7307ce3fbf1af..44a91a96ecb94c1f9bc50f2b013db598308d065c 100644 (file)
@@ -692,7 +692,7 @@ private:
       State.Stack.pop_back();
     }
 
-    if (Current.is(tok::string_literal) && State.StartOfStringLiteral == 0) {
+    if (Current.is(tok::string_literal)) {
       State.StartOfStringLiteral = State.Column;
     } else if (Current.isNot(tok::comment)) {
       State.StartOfStringLiteral = 0;
index ab4825b3145a3e0972609ea732ac437c7ba12163..ca522084d5ef5cc2f5259bec76d35dd55324a147 100644 (file)
@@ -1452,6 +1452,9 @@ TEST_F(FormatTest, AlignsStringLiterals) {
              "\"aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaa "
              "aaaaaaaaaaaaaaaaaaaaa\" "
              "\"aaaaaaaaaaaaaaaa\";"));
+  verifyFormat("a = a + \"a\"\n"
+               "        \"a\"\n"
+               "        \"a\";");
 }
 
 TEST_F(FormatTest, AlignsPipes) {