r175630 - Fix regression in string literal alignment.
Manuel Klimek
klimek at google.com
Wed Feb 20 07:32:58 PST 2013
Author: klimek
Date: Wed Feb 20 09:32:58 2013
New Revision: 175630
URL: http://llvm.org/viewvc/llvm-project?rev=175630&view=rev
Log:
Fix regression in string literal alignment.
Now correctly indents (again):
a = a + "a"
"a"
"a";
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=175630&r1=175629&r2=175630&view=diff
==============================================================================
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Wed Feb 20 09:32:58 2013
@@ -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;
Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=175630&r1=175629&r2=175630&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Wed Feb 20 09:32:58 2013
@@ -1452,6 +1452,9 @@ TEST_F(FormatTest, AlignsStringLiterals)
"\"aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaa "
"aaaaaaaaaaaaaaaaaaaaa\" "
"\"aaaaaaaaaaaaaaaa\";"));
+ verifyFormat("a = a + \"a\"\n"
+ " \"a\"\n"
+ " \"a\";");
}
TEST_F(FormatTest, AlignsPipes) {
More information about the cfe-commits
mailing list