summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/TokenAnnotator.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2015-01-07 12:19:53 +0000
committerDaniel Jasper <djasper@google.com>2015-01-07 12:19:53 +0000
commit6a9682038f2c155520453973b15f3088f7757331 (patch)
treefee072ba708b7856abc3cf384641cd292846a333 /clang/lib/Format/TokenAnnotator.cpp
parent06f22f46781cdc42557ae2b67073660f3839b8b6 (diff)
downloadbcm5719-llvm-6a9682038f2c155520453973b15f3088f7757331.tar.gz
bcm5719-llvm-6a9682038f2c155520453973b15f3088f7757331.zip
clang-format: Fix unary operator detection.
Before: ** outparam = 1; After: **outparam = 1; llvm-svn: 225349
Diffstat (limited to 'clang/lib/Format/TokenAnnotator.cpp')
-rw-r--r--clang/lib/Format/TokenAnnotator.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index 331776c59aa..8966ab2484b 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -741,7 +741,8 @@ private:
void modifyContext(const FormatToken &Current) {
if (Current.getPrecedence() == prec::Assignment &&
- !Line.First->isOneOf(tok::kw_template, tok::kw_using) &&
+ !Line.First->isOneOf(tok::kw_template, tok::kw_using,
+ TT_UnaryOperator) &&
(!Current.Previous || Current.Previous->isNot(tok::kw_operator))) {
Contexts.back().IsExpression = true;
for (FormatToken *Previous = Current.Previous;
@@ -752,11 +753,10 @@ private:
if (!Previous)
break;
}
- if ((Previous->isOneOf(TT_BinaryOperator, TT_UnaryOperator)) &&
+ if (Previous->isOneOf(TT_BinaryOperator, TT_UnaryOperator) &&
Previous->isOneOf(tok::star, tok::amp) && Previous->Previous &&
- Previous->Previous->isNot(tok::equal)) {
+ Previous->Previous->isNot(tok::equal))
Previous->Type = TT_PointerOrReference;
- }
}
} else if (Current.isOneOf(tok::kw_return, tok::kw_throw)) {
Contexts.back().IsExpression = true;
OpenPOWER on IntegriCloud