summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/TokenAnnotator.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2014-07-28 13:19:58 +0000
committerDaniel Jasper <djasper@google.com>2014-07-28 13:19:58 +0000
commit6ba1638f0b1062da45933dbdf8538f121cbd0e2c (patch)
tree093bc64fa9949b5d076eab6e1c9ec52e027d625f /clang/lib/Format/TokenAnnotator.cpp
parent8afad61a9336e8f212ec551a38a1e30411d82ff4 (diff)
downloadbcm5719-llvm-6ba1638f0b1062da45933dbdf8538f121cbd0e2c.tar.gz
bcm5719-llvm-6ba1638f0b1062da45933dbdf8538f121cbd0e2c.zip
clang-format: Improve operator and template recognition.
Before: static_assert(is_convertible < A &&, B > ::value, "AAA"); After: static_assert(is_convertible<A &&, B>::value, "AAA"); llvm-svn: 214075
Diffstat (limited to 'clang/lib/Format/TokenAnnotator.cpp')
-rw-r--r--clang/lib/Format/TokenAnnotator.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index 6a7180bfb01..885d147b9b6 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -69,12 +69,8 @@ private:
// parameters.
// FIXME: This is getting out of hand, write a decent parser.
if (CurrentToken->Previous->isOneOf(tok::pipepipe, tok::ampamp) &&
- ((CurrentToken->Previous->Type == TT_BinaryOperator &&
- // Toplevel bool expressions do not make lots of sense;
- // If we're on the top level, it contains only the base context and
- // the context for the current opening angle bracket.
- Contexts.size() > 2) ||
- Contexts[Contexts.size() - 2].IsExpression) &&
+ CurrentToken->Previous->Type == TT_BinaryOperator &&
+ Contexts[Contexts.size() - 2].IsExpression &&
Line.First->isNot(tok::kw_template))
return false;
updateParameterCount(Left, CurrentToken);
@@ -924,7 +920,7 @@ private:
if (NextToken->is(tok::l_square) && NextToken->Type != TT_LambdaLSquare)
return TT_PointerOrReference;
- if (NextToken->is(tok::kw_operator))
+ if (NextToken->isOneOf(tok::kw_operator, tok::comma))
return TT_PointerOrReference;
if (PrevToken->is(tok::r_paren) && PrevToken->MatchingParen &&
OpenPOWER on IntegriCloud