[PATCH] D43904: [clang-format] Improve detection of ObjC for-in statements

2018-03-06 Thread Ben Hamilton via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL326815: [clang-format] Improve detection of ObjC for-in statements (authored by benhamilton, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D4

[PATCH] D43904: [clang-format] Improve detection of ObjC for-in statements

2018-03-06 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added inline comments. Comment at: unittests/Format/FormatTest.cpp:778 +TEST_F(FormatTest, ObjCForInLoop) { + verifyFormat("for (Foo *x = 0; x != in; x++) {\n}"); krasimir wrote: > Please move the ObjC-specific instances to `FormatTestObjC.cpp`. Do

[PATCH] D43904: [clang-format] Improve detection of ObjC for-in statements

2018-03-06 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton updated this revision to Diff 137199. benhamilton marked an inline comment as done. benhamilton added a comment. - Move ObjC-specific tests to `FormatTestObjC.cpp`. Repository: rC Clang https://reviews.llvm.org/D43904 Files: lib/Format/TokenAnnotator.cpp unittests/Format/Form

[PATCH] D43904: [clang-format] Improve detection of ObjC for-in statements

2018-03-06 Thread Krasimir Georgiev via Phabricator via cfe-commits
krasimir added inline comments. Comment at: unittests/Format/FormatTest.cpp:778 +TEST_F(FormatTest, ObjCForInLoop) { + verifyFormat("for (Foo *x = 0; x != in; x++) {\n}"); Please move the ObjC-specific instances to `FormatTestObjC.cpp`. Repository: rC Clan

[PATCH] D43904: [clang-format] Improve detection of ObjC for-in statements

2018-03-05 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added inline comments. Comment at: lib/Format/TokenAnnotator.cpp:288 +if (MightBeObjCForRangeLoop) { + FormatToken *ForInToken = Left; djasper wrote: > There can be only one ObjCForIn token in any for loop, right? If that's the > c

[PATCH] D43904: [clang-format] Improve detection of ObjC for-in statements

2018-03-05 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton updated this revision to Diff 137093. benhamilton added a comment. One more cleanup Repository: rC Clang https://reviews.llvm.org/D43904 Files: lib/Format/TokenAnnotator.cpp unittests/Format/FormatTest.cpp Index: unittests/Format/FormatTest.cpp =

[PATCH] D43904: [clang-format] Improve detection of ObjC for-in statements

2018-03-05 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton updated this revision to Diff 137092. benhamilton marked an inline comment as done. benhamilton added a comment. - Fix comments from @djasper and @krasimir. Repository: rC Clang https://reviews.llvm.org/D43904 Files: lib/Format/TokenAnnotator.cpp unittests/Format/FormatTest.c

[PATCH] D43904: [clang-format] Improve detection of ObjC for-in statements

2018-03-05 Thread Krasimir Georgiev via Phabricator via cfe-commits
krasimir added inline comments. Comment at: unittests/Format/FormatTest.cpp:12002 +TEST_F(FormatTest, GuessLanguageWithForIn) { + EXPECT_EQ(FormatStyle::LK_Cpp, Please also add this instances as formatting tests. Repository: rC Clang https://reviews.llvm.

[PATCH] D43904: [clang-format] Improve detection of ObjC for-in statements

2018-03-05 Thread Daniel Jasper via Phabricator via cfe-commits
djasper added inline comments. Comment at: lib/Format/TokenAnnotator.cpp:288 +if (MightBeObjCForRangeLoop) { + FormatToken *ForInToken = Left; There can be only one ObjCForIn token in any for loop, right? If that's the case, can we just rememb

[PATCH] D43904: [clang-format] Improve detection of ObjC for-in statements

2018-02-28 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton created this revision. benhamilton added reviewers: krasimir, jolesiak. Herald added a subscriber: cfe-commits. Previously, clang-format would detect the following as an Objective-C for-in statement: for (int x = in.value(); ...) {} because the logic only decided a for-loop was def