summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2015-01-19 11:49:32 +0000
committerDaniel Jasper <djasper@google.com>2015-01-19 11:49:32 +0000
commit9b79efb51f9ec9d6847a7373092c5006da2eeae1 (patch)
tree2a576569838f7df817dd0f64a316b22f327eb9a8 /clang/lib/Format
parent6c6e589c1f09e519aaca5d7161801dd7d6fd8960 (diff)
downloadbcm5719-llvm-9b79efb51f9ec9d6847a7373092c5006da2eeae1.tar.gz
bcm5719-llvm-9b79efb51f9ec9d6847a7373092c5006da2eeae1.zip
clang-format: Fix crasher on weird comments.
Crashing input: /\ / comment llvm-svn: 226454
Diffstat (limited to 'clang/lib/Format')
-rw-r--r--clang/lib/Format/TokenAnnotator.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index 58902bfbd69..df6bfd37ae0 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -838,10 +838,8 @@ private:
(!Current.Previous || Current.Previous->isNot(tok::l_square))) {
Current.Type = TT_BinaryOperator;
} else if (Current.is(tok::comment)) {
- if (Current.TokenText.startswith("//"))
- Current.Type = TT_LineComment;
- else
- Current.Type = TT_BlockComment;
+ Current.Type =
+ Current.TokenText.startswith("/*") ? TT_BlockComment : TT_LineComment;
} else if (Current.is(tok::r_paren)) {
if (rParenEndsCast(Current))
Current.Type = TT_CastRParen;
OpenPOWER on IntegriCloud