aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Format/Format.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2015-06-14 07:16:57 +0000
committerDaniel Jasper <djasper@google.com>2015-06-14 07:16:57 +0000
commit2ebb0c57fbfcebba9de721e65bea0886b8033f36 (patch)
tree93667ae2f0a20b028af887d9472e35e8479c1c21 /clang/lib/Format/Format.cpp
parenta6a250a21145e852fafd5ab316732134ca08eb2c (diff)
downloadllvm-2ebb0c57fbfcebba9de721e65bea0886b8033f36.zip
llvm-2ebb0c57fbfcebba9de721e65bea0886b8033f36.tar.gz
llvm-2ebb0c57fbfcebba9de721e65bea0886b8033f36.tar.bz2
clang-format: [JS] Fix corner case in template string parsing.
Before, these would not properly detected because of the char/string literal found when re-lexing after the first `: var x = `'`; // comment with matching quote ' var x = `"`; // comment with matching quote " llvm-svn: 239693
Diffstat (limited to 'clang/lib/Format/Format.cpp')
-rw-r--r--clang/lib/Format/Format.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index a774f8c..aa91658 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -785,7 +785,8 @@ private:
// Backticks get lexed as tok::unknown tokens. If a template string contains
// a comment start, it gets lexed as a tok::comment, or tok::unknown if
// unterminated.
- if (!EndBacktick->isOneOf(tok::comment, tok::unknown))
+ if (!EndBacktick->isOneOf(tok::comment, tok::string_literal,
+ tok::char_constant, tok::unknown))
return false;
size_t CommentBacktickPos = EndBacktick->TokenText.find('`');
// Unknown token that's not actually a backtick, or a comment that doesn't