Patch to implement AST generation for objective-c's @selector expression.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43038 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Parse/ParseObjc.cpp b/Parse/ParseObjc.cpp
index 3c37962..2747254 100644
--- a/Parse/ParseObjc.cpp
+++ b/Parse/ParseObjc.cpp
@@ -1318,6 +1318,7 @@
return 0;
}
+ llvm::SmallVector<IdentifierInfo *, 12> KeyIdents;
SourceLocation LParenLoc = ConsumeParen();
SourceLocation sLoc;
IdentifierInfo *SelIdent = ParseObjCSelector(sLoc);
@@ -1326,6 +1327,9 @@
Diag(Tok, diag::err_expected_ident); // missing selector name.
return 0;
}
+ if (!SelIdent)
+ SelIdent = &PP.getIdentifierTable().get("");
+ KeyIdents.push_back(SelIdent);
if (Tok.isNot(tok::r_paren))
while (1) {
if (Tok.isNot(tok::colon)) {
@@ -1338,11 +1342,15 @@
// Check for another keyword selector.
SourceLocation Loc;
SelIdent = ParseObjCSelector(Loc);
+ if (!SelIdent)
+ SelIdent = &PP.getIdentifierTable().get("");
+ KeyIdents.push_back(SelIdent);
if (!SelIdent && Tok.isNot(tok::colon))
break;
}
SourceLocation RParenLoc = MatchRHSPunctuation(tok::r_paren, LParenLoc);
-
- // FIXME
- return 0;
-}
\ No newline at end of file
+ Selector Sel = PP.getSelectorTable().getSelector(KeyIdents.size(),
+ &KeyIdents[0]);
+ return Actions.ParseObjCSelectorExpression(Sel, SelectorLoc, LParenLoc,
+ RParenLoc);
+ }
\ No newline at end of file