Skip to content

Commit 397c2e7

Browse files
committed
Allow any token that has an identifier (except __attribute__) to be part
of a selector
1 parent 8ce8105 commit 397c2e7

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

clang/lib/Parse/ParseObjc.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,8 +1067,6 @@ Decl *Parser::ParseObjCMethodPrototype(tok::ObjCKeywordKind MethodImplKind,
10671067
IdentifierInfo *Parser::ParseObjCSelectorPiece(SourceLocation &SelectorLoc) {
10681068

10691069
switch (Tok.getKind()) {
1070-
default:
1071-
return nullptr;
10721070
case tok::colon:
10731071
// Empty selector piece uses the location of the ':'.
10741072
SelectorLoc = Tok.getLocation();
@@ -1094,10 +1092,13 @@ IdentifierInfo *Parser::ParseObjCSelectorPiece(SourceLocation &SelectorLoc) {
10941092
return nullptr;
10951093
}
10961094

1097-
case tok::identifier:
1098-
#define KEYWORD(X,Y) case tok::kw_ ## X:
1099-
#include "clang/Basic/TokenKinds.def"
1095+
case tok::kw___attribute:
1096+
return nullptr;
1097+
1098+
default:
11001099
IdentifierInfo *II = Tok.getIdentifierInfo();
1100+
if (!II)
1101+
return nullptr;
11011102
SelectorLoc = ConsumeToken();
11021103
return II;
11031104
}

0 commit comments

Comments
 (0)