]> granicus.if.org Git - clang/commit
[clang-format] Fix ObjC selectors with multiple params passed to macro
authorBen Hamilton <benhamilton@google.com>
Tue, 20 Mar 2018 14:53:25 +0000 (14:53 +0000)
committerBen Hamilton <benhamilton@google.com>
Tue, 20 Mar 2018 14:53:25 +0000 (14:53 +0000)
commit2f7c11b4591a923041ecb714e3c082b6a88ef45f
treef90cff5596db77632a8843869cd3581d60c022e7
parent53912bffa018f111a2d87bdee85a77316cbf2f41
[clang-format] Fix ObjC selectors with multiple params passed to macro

Summary:
Objective-C selectors with arguments take the form of:

foo:
foo:bar:
foo:bar:baz:

These can be passed to a macro, like NS_SWIFT_NAME():

https://developer.apple.com/library/content/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html

and must never have spaces inserted around the colons.

Previously, there was logic in TokenAnnotator's tok::colon parser to
handle the single-argument case, but it failed for the
multiple-argument cases.

This diff fixes the bug and adds more tests.

Test Plan: New tests added. Ran tests with:
  % make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests

Reviewers: jolesiak, djasper, Wizard

Reviewed By: jolesiak, Wizard

Subscribers: klimek, cfe-commits

Differential Revision: https://reviews.llvm.org/D44638

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327986 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Format/TokenAnnotator.cpp
unittests/Format/FormatTestObjC.cpp