[PATCH] D34351: Simplify TT_SelectorName assignment logic

Krasimir Georgiev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 19 08:03:11 PDT 2017


krasimir created this revision.
Herald added a subscriber: klimek.

While trying to understand TT_SelectorName, I found 2 redundant checks.
Removing them doesn't cause any tests to fail.


https://reviews.llvm.org/D34351

Files:
  lib/Format/TokenAnnotator.cpp


Index: lib/Format/TokenAnnotator.cpp
===================================================================
--- lib/Format/TokenAnnotator.cpp
+++ lib/Format/TokenAnnotator.cpp
@@ -443,10 +443,9 @@
         if (CurrentToken->isOneOf(tok::colon, tok::l_brace)) {
           FormatToken *Previous = CurrentToken->getPreviousNonComment();
           if (((CurrentToken->is(tok::colon) &&
-                (!Contexts.back().ColonIsDictLiteral || !Style.isCpp())) ||
+                !Contexts.back().ColonIsDictLiteral) ||
                Style.Language == FormatStyle::LK_Proto) &&
-              (Previous->Tok.getIdentifierInfo() ||
-               Previous->is(tok::string_literal)))
+              Previous->Tok.getIdentifierInfo())
             Previous->Type = TT_SelectorName;
           if (CurrentToken->is(tok::colon) ||
               Style.Language == FormatStyle::LK_JavaScript)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34351.103043.patch
Type: text/x-patch
Size: 885 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170619/1fb13b27/attachment.bin>


More information about the cfe-commits mailing list