diff options
author | Nico Weber <nicolasweber@gmx.de> | 2013-02-11 15:32:15 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2013-02-11 15:32:15 +0000 |
commit | c2e6d2a4a7fe9dfa7d52a38c6048b7b18e6b591a (patch) | |
tree | 079b1d7737ae0fed7eb6751a3c26b61076d18e9c /unittests/Format/FormatTest.cpp | |
parent | 3f4535e44965f46cf603146141d2d27a1cef1f7f (diff) |
Formatter: Detect ObjC message expressions after 'in' in loop
Before:
for (id foo in[self getStuffFor : bla]) {
}
Now:
for (id foo in [self getStuffFor:bla]) {
}
"in" is treated as loop keyword if the line starts with "for", and as a
regular identifier else. To check for "in", its IdentifierInfo is handed
through a few layers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174889 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Format/FormatTest.cpp')
-rw-r--r-- | unittests/Format/FormatTest.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index f9e73bb102..9b9f5c71d2 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -2427,6 +2427,10 @@ TEST_F(FormatTest, FormatObjCMethodExpr) { verifyFormat("[foo bar:baz] % [foo bar:baz];"); // Whew! + verifyFormat("return in[42];"); + verifyFormat("for (id foo in [self getStuffFor:bla]) {\n" + "}"); + verifyFormat("[self stuffWithInt:(4 + 2) float:4.5];"); verifyFormat("[self stuffWithInt:a ? b : c float:4.5];"); verifyFormat("[self stuffWithInt:a ? [self foo:bar] : c];"); |