Fix regression in string literal alignment.
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
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp
index aca5d36..44a91a9 100644
--- a/lib/Format/Format.cpp
+++ b/lib/Format/Format.cpp
@@ -692,7 +692,7 @@
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;
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index ab4825b..ca52208 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -1452,6 +1452,9 @@
"\"aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaa "
"aaaaaaaaaaaaaaaaaaaaa\" "
"\"aaaaaaaaaaaaaaaa\";"));
+ verifyFormat("a = a + \"a\"\n"
+ " \"a\"\n"
+ " \"a\";");
}
TEST_F(FormatTest, AlignsPipes) {