aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Parse/ParseObjc.cpp24
-rw-r--r--include/clang/Parse/Parser.h2
2 files changed, 22 insertions, 4 deletions
diff --git a/Parse/ParseObjc.cpp b/Parse/ParseObjc.cpp
index 624932ffe4..62149a040a 100644
--- a/Parse/ParseObjc.cpp
+++ b/Parse/ParseObjc.cpp
@@ -41,7 +41,7 @@ Parser::DeclTy *Parser::ParseObjCAtDirectives() {
case tok::objc_end:
return ParseObjCAtEndDeclaration(AtLoc);
case tok::objc_compatibility_alias:
- return ParseObjCAtAliasDeclaration();
+ return ParseObjCAtAliasDeclaration(AtLoc);
case tok::objc_synthesize:
return ParseObjCPropertySynthesize(AtLoc);
case tok::objc_dynamic:
@@ -762,8 +762,26 @@ Parser::DeclTy *Parser::ParseObjCAtEndDeclaration(SourceLocation atLoc) {
return 0;
}
-Parser::DeclTy *Parser::ParseObjCAtAliasDeclaration() {
- assert(0 && "Unimp");
+
+/// compatibility-alias-decl:
+/// @compatibility_alias alias-name class-name ';'
+///
+Parser::DeclTy *Parser::ParseObjCAtAliasDeclaration(SourceLocation atLoc) {
+ assert(Tok.isObjCAtKeyword(tok::objc_compatibility_alias) &&
+ "ParseObjCAtAliasDeclaration(): Expected @compatibility_alias");
+ ConsumeToken(); // consume compatibility_alias
+ if (Tok.getKind() != tok::identifier) {
+ Diag(Tok, diag::err_expected_ident);
+ return 0;
+ }
+ ConsumeToken(); // consume alias-name
+ if (Tok.getKind() != tok::identifier) {
+ Diag(Tok, diag::err_expected_ident);
+ return 0;
+ }
+ ConsumeToken(); // consume class-name;
+ if (Tok.getKind() != tok::semi)
+ Diag(Tok, diag::err_expected_semi_after, "@synthesize");
return 0;
}
diff --git a/include/clang/Parse/Parser.h b/include/clang/Parse/Parser.h
index 76eab0d898..9d8021a24c 100644
--- a/include/clang/Parse/Parser.h
+++ b/include/clang/Parse/Parser.h
@@ -264,7 +264,7 @@ private:
DeclTy *ParseObjCAtProtocolDeclaration(SourceLocation atLoc);
DeclTy *ParseObjCAtImplementationDeclaration(SourceLocation atLoc);
DeclTy *ParseObjCAtEndDeclaration(SourceLocation atLoc);
- DeclTy *ParseObjCAtAliasDeclaration();
+ DeclTy *ParseObjCAtAliasDeclaration(SourceLocation atLoc);
DeclTy *ParseObjCPropertySynthesize(SourceLocation atLoc);
DeclTy *ParseObjCPropertyDynamic(SourceLocation atLoc);