summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2014-10-28 18:11:52 +0000
committerDaniel Jasper <djasper@google.com>2014-10-28 18:11:52 +0000
commit13a7f469be4db05f13bf6636aedf223f7a4f307a (patch)
treee727ebe4fc84b1688690319e90f4722eb857d3d0 /clang/lib/Format
parentd6b46b46b6d3aa3fb45158b275390d0e3f15e5c1 (diff)
downloadbcm5719-llvm-13a7f469be4db05f13bf6636aedf223f7a4f307a.tar.gz
bcm5719-llvm-13a7f469be4db05f13bf6636aedf223f7a4f307a.zip
clang-format: Improve && detection as binary operators.
Before: template <class T, class = typename std::enable_if<std::is_integral< T>::value &&(sizeof(T) > 1 || sizeof(T) < 8)>::type> void F(); After: template <class T, class = typename std::enable_if< std::is_integral<T>::value && (sizeof(T) > 1 || sizeof(T) < 8)>::type> void F(); llvm-svn: 220805
Diffstat (limited to 'clang/lib/Format')
-rw-r--r--clang/lib/Format/TokenAnnotator.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index ff0af5a08c5..14d164e2ae7 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -992,6 +992,10 @@ private:
(InTemplateArgument && NextToken->Tok.isAnyIdentifier()))
return TT_BinaryOperator;
+ // "&&(" is quite unlikely to be two successive unary "&".
+ if (Tok.is(tok::ampamp) && NextToken && NextToken->is(tok::l_paren))
+ return TT_BinaryOperator;
+
// This catches some cases where evaluation order is used as control flow:
// aaa && aaa->f();
const FormatToken *NextNextToken = NextToken->getNextNonComment();
OpenPOWER on IntegriCloud