diff options
author | Daniel Jasper <djasper@google.com> | 2013-02-27 11:43:50 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-02-27 11:43:50 +0000 |
commit | 9c65b069821b7de79427e291b006293a0f55ff8f (patch) | |
tree | 422f3f0daa889ac3bce71c68120c001d159e1286 /lib/Format/TokenAnnotator.cpp | |
parent | 8614304c0d728d43ef16691708281273101b00af (diff) |
Fix formatting of multiplications in array subscripts.
Before:
a[a* a] = 1;
After:
a[a * a] = 1;
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176180 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/TokenAnnotator.cpp')
-rw-r--r-- | lib/Format/TokenAnnotator.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/Format/TokenAnnotator.cpp b/lib/Format/TokenAnnotator.cpp index 67ad08a389..164b722f82 100644 --- a/lib/Format/TokenAnnotator.cpp +++ b/lib/Format/TokenAnnotator.cpp @@ -190,6 +190,7 @@ private: // expression, or it could the the start of an Objective-C array literal. AnnotatedToken *Left = CurrentToken->Parent; AnnotatedToken *Parent = getPreviousToken(*Left); + Contexts.back().IsExpression = true; bool StartsObjCMethodExpr = !Parent || Parent->is(tok::colon) || Parent->is(tok::l_square) || Parent->is(tok::l_paren) || Parent->is(tok::kw_return) || @@ -550,6 +551,8 @@ private: for (AnnotatedToken *Previous = Current.Parent; Previous && Previous->isNot(tok::comma); Previous = Previous->Parent) { + if (Previous->is(tok::r_square)) + Previous = Previous->MatchingParen; if (Previous->Type == TT_BinaryOperator && (Previous->is(tok::star) || Previous->is(tok::amp))) { Previous->Type = TT_PointerOrReference; |