aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Format/Format.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2015-07-02 15:00:44 +0000
committerDaniel Jasper <djasper@google.com>2015-07-02 15:00:44 +0000
commitf144620cc19a51268199b2661e7097d9ab0448e4 (patch)
tree526ec5eb4a5ff8ee90897727ca77aa8316079339 /clang/lib/Format/Format.cpp
parent07d4496ab7c7dbad8e43fe621b09f600ba678b3c (diff)
downloadllvm-f144620cc19a51268199b2661e7097d9ab0448e4.zip
llvm-f144620cc19a51268199b2661e7097d9ab0448e4.tar.gz
llvm-f144620cc19a51268199b2661e7097d9ab0448e4.tar.bz2
clang-format: [JS] Treat regex literals like string literals.
Using the token type "unknown" can interfere badly with WhitespaceManager's way of handling multiline comments. llvm-svn: 241273
Diffstat (limited to 'clang/lib/Format/Format.cpp')
-rw-r--r--clang/lib/Format/Format.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index f97e1fb..2bbe4c63 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -808,6 +808,8 @@ private:
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;
}