1. Fix parsing of method prototype involving c-style argument declarations.
2. Fixes all allowable key-words used as selectors.
3. Template to do the messaging parse.
4. A test case for all allowable selector names.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41723 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Parse/ParseObjc.cpp b/Parse/ParseObjc.cpp
index f82555a..cb65c1c 100644
--- a/Parse/ParseObjc.cpp
+++ b/Parse/ParseObjc.cpp
@@ -384,10 +384,9 @@
tok::TokenKind tKind = Tok.getKind();
IdentifierInfo *II = 0;
- if (tKind == tok::identifier ||
+ if (tKind == tok::identifier || tKind == tok::kw_typeof ||
+ tKind == tok::kw___alignof ||
(tKind >= tok::kw_auto && tKind <= tok::kw__Complex)) {
- // FIXME: make sure the list of keywords jives with gcc. For example,
- // the above test does not include in/out/inout/bycopy/byref/oneway.
II = Tok.getIdentifierInfo();
ConsumeToken();
}
@@ -516,7 +515,12 @@
ConsumeToken();
break;
}
- ParseDeclaration(Declarator::PrototypeContext);
+ // Parse the c-style argument declaration-specifier.
+ DeclSpec DS;
+ ParseDeclarationSpecifiers(DS);
+ // Parse the declarator.
+ Declarator ParmDecl(DS, Declarator::PrototypeContext);
+ ParseDeclarator(ParmDecl);
}
} else if (!selIdent) {
Diag(Tok, diag::err_expected_ident); // missing selector name.
@@ -910,6 +914,37 @@
return 0;
}
+/// objc-message-expr:
+/// '[' objc-receiver objc-message-args ']'
+///
+/// objc-receiver:
+/// expression
+/// class-name
+/// type-name
+///
+/// objc-message-args:
+/// objc-selector
+/// objc-keywordarg-list
+///
+/// objc-keywordarg-list:
+/// objc-keywordarg
+/// objc-keywordarg-list objc-keywordarg
+///
+/// objc-keywordarg:
+/// selector-name[opt] ':' objc-keywordexpr
+///
+/// objc-keywordexpr:
+/// nonempty-expr-list
+///
+/// nonempty-expr-list:
+/// assignment-expression
+/// nonempty-expr-list , assignment-expression
+///
+Parser::ExprResult Parser::ParseObjCMessageExpression() {
+ assert(false && "Unimp");
+ return 0;
+}
+
Parser::ExprResult Parser::ParseObjCStringLiteral() {
ExprResult Res = ParseStringLiteralExpression();