aboutsummaryrefslogtreecommitdiff
path: root/lib/Format/Format.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Format/Format.cpp')
-rw-r--r--lib/Format/Format.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp
index 548bdee2b2..57e9a76989 100644
--- a/lib/Format/Format.cpp
+++ b/lib/Format/Format.cpp
@@ -1060,7 +1060,10 @@ private:
/// \brief Determine whether ++/-- are pre- or post-increments/-decrements.
TokenType determineIncrementUsage(const AnnotatedToken &Tok) {
- if (Tok.Parent != NULL && Tok.Parent->is(tok::identifier))
+ if (Tok.Parent == NULL)
+ return TT_UnaryOperator;
+ if (Tok.Parent->is(tok::r_paren) || Tok.Parent->is(tok::r_square) ||
+ Tok.Parent->is(tok::identifier))
return TT_TrailingUnaryOperator;
return TT_UnaryOperator;