summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/TokenAnnotator.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2014-03-25 10:52:45 +0000
committerDaniel Jasper <djasper@google.com>2014-03-25 10:52:45 +0000
commita65e8875878d00c124ab52ba80cac04037ea44e5 (patch)
tree2136d4932880ea6d2b95916e6769093f8b113158 /clang/lib/Format/TokenAnnotator.cpp
parent517ff05ffb5d5060e9541f852aed4cda52244163 (diff)
downloadbcm5719-llvm-a65e8875878d00c124ab52ba80cac04037ea44e5.tar.gz
bcm5719-llvm-a65e8875878d00c124ab52ba80cac04037ea44e5.zip
clang-format: Fix incorrect &/* detection.
Before: STATIC_ASSERT((a &b) == 0); After: STATIC_ASSERT((a & b) == 0); llvm-svn: 204709
Diffstat (limited to 'clang/lib/Format/TokenAnnotator.cpp')
-rw-r--r--clang/lib/Format/TokenAnnotator.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index efb983e7366..369a37b082e 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -98,8 +98,10 @@ private:
}
}
- if (Left->Previous && Left->Previous->isOneOf(tok::kw_static_assert,
- tok::kw_if, tok::kw_while)) {
+ if (Left->Previous &&
+ (Left->Previous->isOneOf(tok::kw_static_assert, tok::kw_if,
+ tok::kw_while, tok::l_paren, tok::comma) ||
+ Left->Previous->Type == TT_BinaryOperator)) {
// static_assert, if and while usually contain expressions.
Contexts.back().IsExpression = true;
} else if (Left->Previous && Left->Previous->is(tok::r_square) &&
OpenPOWER on IntegriCloud