]> granicus.if.org Git - clang/commit
[clang-format/ObjC] Use getIdentifierInfo() instead of tok::identifier
authorBen Hamilton <benhamilton@google.com>
Fri, 27 Apr 2018 18:51:12 +0000 (18:51 +0000)
committerBen Hamilton <benhamilton@google.com>
Fri, 27 Apr 2018 18:51:12 +0000 (18:51 +0000)
commit38b6bf084ebd78ba346e69fbcebe3acf2770ede5
treec47f4309f6f7fbba31bfe4a16b684e50c9c63c14
parent78badc6e747fc3e3b1c39347c6c8e3107dcf7118
[clang-format/ObjC] Use getIdentifierInfo() instead of tok::identifier

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

Reviewers: djasper, jolesiak

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

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