Using the token type "unknown" can interfere badly with
WhitespaceManager's way of handling multiline comments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241273
91177308-0d34-0410-b5e6-
96231b3b80d8
Tokens.resize(Tokens.size() - TokenCount);
Tokens.back()->Tok.setKind(tok::unknown);
Tokens.back()->Type = TT_RegexLiteral;
+ // Treat regex literals like other string_literals.
+ Tokens.back()->Tok.setKind(tok::string_literal);
Tokens.back()->ColumnWidth += LastColumn - I[0]->OriginalColumn;
return true;
}
getGoogleJSStyleWithColumns(15));
verifyFormat("var regex = //\n"
" /a/;");
+ verifyFormat("var regexs = [\n"
+ " /d/, //\n"
+ " /aa/, //\n"
+ "];");
}
TEST_F(FormatTestJS, RegexLiteralModifiers) {