summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-01-02 15:26:16 +0000
committerDaniel Jasper <djasper@google.com>2013-01-02 15:26:16 +0000
commitda1c68ab715c779c6a6d87765ffc3fd83403765d (patch)
tree03a9292acc409a58f43f25a3e661058a09c27a91 /clang/lib
parentac5c1c286cbc0b00b977544dc69ddde299f8db0e (diff)
downloadbcm5719-llvm-da1c68ab715c779c6a6d87765ffc3fd83403765d.tar.gz
bcm5719-llvm-da1c68ab715c779c6a6d87765ffc3fd83403765d.zip
Understand unary operators after "return" and "case".
This fixes llvm.org/PR14746. Before: return - 1; After: return -1; llvm-svn: 171389
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Format/Format.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index d354078231c..c08bcf4f5c1 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -852,7 +852,8 @@ private:
const Token &PreviousTok = Line.Tokens[Index - 1].Tok;
if (PreviousTok.is(tok::equal) || PreviousTok.is(tok::l_paren) ||
PreviousTok.is(tok::comma) || PreviousTok.is(tok::l_square) ||
- PreviousTok.is(tok::question) || PreviousTok.is(tok::colon))
+ PreviousTok.is(tok::question) || PreviousTok.is(tok::colon) ||
+ PreviousTok.is(tok::kw_return) || PreviousTok.is(tok::kw_case))
return TokenAnnotation::TT_UnaryOperator;
// There can't be to consecutive binary operators.
OpenPOWER on IntegriCloud