/// [GNU] '__builtin_choose_expr' '(' assign-expr ',' assign-expr ','
/// assign-expr ')'
/// [GNU] '__builtin_types_compatible_p' '(' type-name ',' type-name ')'
-/// [OBC] '[' objc-receiver objc-message-args ']' [TODO]
-/// [OBC] '@selector' '(' objc-selector-arg ')' [TODO]
-/// [OBC] '@protocol' '(' identifier ')' [TODO]
-/// [OBC] '@encode' '(' type-name ')' [TODO]
-/// [OBC] objc-string-literal
+/// [OBJC] '[' objc-message-expr ']' [TODO]
+/// [OBJC] '@selector' '(' objc-selector-arg ')' [TODO]
+/// [OBJC] '@protocol' '(' identifier ')' [TODO]
+/// [OBJC] '@encode' '(' type-name ')' [TODO]
+/// [OBJC] objc-string-literal
/// [C++] 'const_cast' '<' type-name '>' '(' expression ')' [C++ 5.2p1]
/// [C++] 'dynamic_cast' '<' type-name '>' '(' expression ')' [C++ 5.2p1]
/// [C++] 'reinterpret_cast' '<' type-name '>' '(' expression ')' [C++ 5.2p1]
return ParseCXXCasts();
case tok::at:
return ParseObjCExpression();
+ case tok::l_square:
+ return ParseObjCMessageExpression ();
default:
Diag(Tok, diag::err_expected_expression);
return ExprResult(true);
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();
}
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.
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();
--- /dev/null
+// RUN: clang %s -parse-noop
+@interface MyObject
+- (void) bycopy : (int) woodo, ... ;
+- (void) break : (int) woodo, ... ;
+- (void) enum : (int) woodo, ... ;
+- (void) struct : (int) woodo, ... ;
+- (void) union : (int) woodo, ... ;
+- (void) if : (int) woodo, int i, char chh, ... ;
+- (void) else : (int) woodo, ... ;
+- (void) while : (int) woodo, ... ;
+- (void) do : (int) woodo, ... ;
+- (void) for : (int) woodo, ... ;
+- (void) switch : (int) woodo, ... ;
+- (void) case : (int) woodo, ... ;
+- (void) default : (int) woodo, ... ;
+- (void) break : (int) woodo, ... ;
+- (void) continue : (int) woodo, ... ;
+- (void) return : (int) woodo, ... ;
+- (void) goto : (int) woodo, ... ;
+- (void) sizeof : (int) woodo, ... ;
+- (void) typeof : (int) woodo, ... ;
+- (void) __alignof : (int) woodo, ... ;
+- (void) unsigned : (int) woodo, ... ;
+- (void) long : (int) woodo, ... ;
+- (void) const : (int) woodo, ... ;
+- (void) short : (int) woodo, ... ;
+- (void) volatile : (int) woodo, ... ;
+- (void) signed : (int) woodo, ... ;
+- (void) restrict : (int) woodo, ... ;
+- (void) _Complex : (int) woodo, ... ;
+- (void) in : (int) woodo, ... ;
+- (void) out : (int) woodo, ... ;
+- (void) inout : (int) woodo, ... ;
+- (void) bycopy : (int) woodo, ... ;
+- (void) byref : (int) woodo, ... ;
+- (void) oneway : (int) woodo, ... ;
+- (void) int : (int) woodo, ... ;
+- (void) char : (int) woodo, ... ;
+- (void) float : (int) woodo, ... ;
+- (void) double : (int) woodo, ... ;
+- (void) void : (int) woodo, ... ;
+- (void) _Bool : (int) woodo, ... ;
+@end