diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2007-09-05 19:52:07 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2007-09-05 19:52:07 +0000 |
commit | 0ccb27ded12fd03eb6818a880f50901bb70254fe (patch) | |
tree | 7cd16f7254a4017c62da8ea72d32389231cdbf57 /Parse/ParseObjc.cpp | |
parent | 8cd8c66914638429294ac510a4f15f43ba7f36a5 (diff) |
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
Diffstat (limited to 'Parse/ParseObjc.cpp')
-rw-r--r-- | Parse/ParseObjc.cpp | 43 |
1 files changed, 39 insertions, 4 deletions
diff --git a/Parse/ParseObjc.cpp b/Parse/ParseObjc.cpp index f82555a9b6..cb65c1c27a 100644 --- a/Parse/ParseObjc.cpp +++ b/Parse/ParseObjc.cpp @@ -384,10 +384,9 @@ IdentifierInfo *Parser::ParseObjCSelector() { 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 @@ void Parser::ParseObjCMethodDecl(tok::TokenKind mType, SourceLocation mLoc) { 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 @@ Parser::ExprResult Parser::ParseObjCExpression() { 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(); |