aboutsummaryrefslogtreecommitdiff
path: root/lib/Format/Format.cpp
diff options
context:
space:
mode:
authorManuel Klimek <klimek@google.com>2013-01-11 19:17:44 +0000
committerManuel Klimek <klimek@google.com>2013-01-11 19:17:44 +0000
commitd5688cf3e314819ca196053ac245c19a7c321332 (patch)
tree182eb99e52888583f6e40a29537b85a23eca049a /lib/Format/Format.cpp
parentd465843f5376c7c1574fe61338cbf3dc50684d5b (diff)
Fix single-line optimization for ObjC.
Puts blocks always into multiple lines when they start with an ObjC keyword or minus. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172238 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/Format.cpp')
-rw-r--r--lib/Format/Format.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp
index df5b4cbb9f..cee587bf32 100644
--- a/lib/Format/Format.cpp
+++ b/lib/Format/Format.cpp
@@ -1338,10 +1338,12 @@ private:
// brace.
FormatToken *Last = &Combined.RootToken;
bool AllowedTokens =
- !Last->Tok.is(tok::kw_if) && !Last->Tok.is(tok::kw_while) &&
- !Last->Tok.is(tok::kw_do) && !Last->Tok.is(tok::r_brace) &&
- !Last->Tok.is(tok::kw_else) && !Last->Tok.is(tok::kw_try) &&
- !Last->Tok.is(tok::kw_catch) && !Last->Tok.is(tok::kw_for);
+ Last->Tok.isNot(tok::kw_if) && Last->Tok.isNot(tok::kw_while) &&
+ Last->Tok.isNot(tok::kw_do) && Last->Tok.isNot(tok::r_brace) &&
+ Last->Tok.isNot(tok::kw_else) && Last->Tok.isNot(tok::kw_try) &&
+ Last->Tok.isNot(tok::kw_catch) && Last->Tok.isNot(tok::kw_for) &&
+ // This gets rid of all ObjC @ keywords and - based definitions.
+ Last->Tok.isNot(tok::at) && Last->Tok.isNot(tok::minus);
while (!Last->Children.empty())
Last = &Last->Children.back();
if (!Last->Tok.is(tok::l_brace))