This is an archive of the discontinued LLVM Phabricator instance.

[clang-format/ObjC] Use getIdentifierInfo() instead of tok::identifier
ClosedPublic

Authored by benhamilton on Apr 26 2018, 1:17 PM.

Details

Summary

Previously, we checked tokens for tok::identifier to see if they
were identifiers inside an Objective-C selector.

However, this missed C++ keywords like new and delete.

To fix this, this diff uses getIdentifierInfo() to find
identifiers or keywords inside Objective-C selectors.

Test Plan: New tests added. Ran tests with:

% make -j16 FormatTests && ./tools/clang/unittests/Format/FormatTests

Diff Detail

Repository
rC Clang

Event Timeline

benhamilton created this revision.Apr 26 2018, 1:17 PM

Add helper canBeObjCSelectorComponent() with comments.

djasper accepted this revision.Apr 27 2018, 10:15 AM

Looks good, thank you.

This revision is now accepted and ready to land.Apr 27 2018, 10:15 AM
This revision was automatically updated to reflect the committed changes.