aboutsummaryrefslogtreecommitdiff
path: root/lib/Format/Format.cpp
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
commit1f0754bf761f7d4910348ce3aba867d34473bceb (patch)
treef05cd17da0b008143d20f71881d0624ab56b1b8f /lib/Format/Format.cpp
parent9a64fb5690ba2b53c761def068e20ec64c584d96 (diff)
Understand unary operators after "return" and "case".
This fixes llvm.org/PR14746. Before: return - 1; After: return -1; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171389 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/Format.cpp')
-rw-r--r--lib/Format/Format.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp
index d354078231..c08bcf4f5c 100644
--- a/lib/Format/Format.cpp
+++ b/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.