forked from OSchip/llvm-project
clang-format: Fix alignment of ObjC string literals.
This used to interfere with AlwaysBreakBeforeMultilineStrings. This fixes llvm.org/PR17856. llvm-svn: 194310
This commit is contained in:
parent
d1c58ed8a7
commit
279430585a
|
@ -135,7 +135,7 @@ bool ContinuationIndenter::mustBreak(const LineState &State) {
|
|||
return true;
|
||||
if (Style.AlwaysBreakBeforeMultilineStrings &&
|
||||
State.Column > State.Stack.back().Indent && // Breaking saves columns.
|
||||
!Previous.isOneOf(tok::kw_return, tok::lessless) &&
|
||||
!Previous.isOneOf(tok::kw_return, tok::lessless, tok::at) &&
|
||||
Previous.Type != TT_InlineASMColon && NextIsMultilineString(State))
|
||||
return true;
|
||||
if (((Previous.Type == TT_DictLiteral && Previous.is(tok::l_brace)) ||
|
||||
|
|
|
@ -3636,6 +3636,13 @@ TEST_F(FormatTest, AlwaysBreakBeforeMultilineStrings) {
|
|||
"b\\\n"
|
||||
"c\";",
|
||||
Break));
|
||||
|
||||
// Exempt ObjC strings for now.
|
||||
EXPECT_EQ("NSString *const kString = @\"aaaa\"\n"
|
||||
" \"bbbb\";",
|
||||
format("NSString *const kString = @\"aaaa\"\n"
|
||||
"\"bbbb\";",
|
||||
Break));
|
||||
}
|
||||
|
||||
TEST_F(FormatTest, AlignsPipes) {
|
||||
|
|
Loading…
Reference in New Issue