[PATCH] D43906: [clang-format] Improve detection of Objective-C block types
Daniel Jasper via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 5 10:54:12 PST 2018
djasper added a comment.
Would it be enough to only add the block type case? With the macro false positive, there won't be an open paren after the closing paren, right?
================
Comment at: lib/Format/TokenAnnotator.cpp:155
+ Next->startsSequence(tok::identifier, tok::l_square,
+ tok::numeric_constant, tok::r_square,
+ tok::r_paren, tok::l_paren))) {
----------------
This seems suspect. Does it have to be a numeric_constant?
================
Comment at: unittests/Format/FormatTest.cpp:12029
+ EXPECT_EQ(FormatStyle::LK_Cpp, guessLanguage("foo.h", "FOO(^);"));
+ EXPECT_EQ(FormatStyle::LK_ObjC,
+ guessLanguage("foo.h", "int(^)(char, float);"));
----------------
I am somewhat skeptical about all these tests now being solely about guessLanguage. It might be the best choice for some of them, but also, there might be other things we do to detect ObjC at some point and then all of these tests become meaningless.
Does your change create a different formatting here?
Repository:
rC Clang
https://reviews.llvm.org/D43906
More information about the cfe-commits
mailing list