diff options
| author | Daniel Jasper <djasper@google.com> | 2014-06-30 13:44:47 +0000 |
|---|---|---|
| committer | Daniel Jasper <djasper@google.com> | 2014-06-30 13:44:47 +0000 |
| commit | 91beebd04ae90a5f637e080ddf7a340c9c7eb000 (patch) | |
| tree | 325342482a6f61ca26b2203e021f871a23d6b08c /clang/lib/Format/TokenAnnotator.cpp | |
| parent | ae82987cf8f64baafeff49e0446252d0f5db0268 (diff) | |
| download | bcm5719-llvm-91beebd04ae90a5f637e080ddf7a340c9c7eb000.tar.gz bcm5719-llvm-91beebd04ae90a5f637e080ddf7a340c9c7eb000.zip | |
clang-format: Improve expression heuristics.
Upon encountering a binary operator inside parentheses, assume that the
parentheses contain an expression.
Before:
MACRO('0' <= c&& c <= '9');
After:
MACRO('0' <= c && c <= '9');
llvm-svn: 212040
Diffstat (limited to 'clang/lib/Format/TokenAnnotator.cpp')
| -rw-r--r-- | clang/lib/Format/TokenAnnotator.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 0760f35bbbc..c1fbf81e119 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -164,6 +164,8 @@ private: CurrentToken->Previous->Previous->isOneOf(tok::l_paren, tok::coloncolon)) MightBeFunctionType = true; + if (CurrentToken->Previous->Type == TT_BinaryOperator) + Contexts.back().IsExpression = true; if (CurrentToken->is(tok::r_paren)) { if (MightBeFunctionType && CurrentToken->Next && (CurrentToken->Next->is(tok::l_paren) || |

