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)
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)
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits