void BreakableStringLiteral::insertBreak(unsigned LineIndex,
unsigned TailOffset, Split Split,
WhitespaceManager &Whitespaces) {
+ unsigned LeadingSpaces = StartColumn;
+ // The '@' of an ObjC string literal (@"Test") does not become part of the
+ // string token.
+ // FIXME: It might be a cleaner solution to merge the tokens as a
+ // precomputation step.
+ if (Prefix.startswith("@"))
+ --LeadingSpaces;
Whitespaces.replaceWhitespaceInToken(
Tok, Prefix.size() + TailOffset + Split.first, Split.second, Postfix,
- Prefix, InPPDirective, 1, IndentLevel, StartColumn);
+ Prefix, InPPDirective, 1, IndentLevel, LeadingSpaces);
}
static StringRef getLineCommentPrefix(StringRef Comment) {
Current.Previous->is(tok::at)) {
IsNSStringLiteral = true;
Prefix = "@\"";
- --StartColumn;
}
if ((Text.endswith(Postfix = "\"") &&
(IsNSStringLiteral || Text.startswith(Prefix = "\"") ||
format("L\"wide string literal\";", getGoogleStyleWithColumns(16)));
EXPECT_EQ("@\"NSString \"\n"
"@\"literal\";",
- format("@\"NSString literal\";", getGoogleStyleWithColumns(16)));
+ format("@\"NSString literal\";", getGoogleStyleWithColumns(19)));
}
TEST_F(FormatTest, BreaksRawStringLiterals) {