]> granicus.if.org Git - clang/commitdiff
Patch to parse objective-c's @compatibility_alias directive.
authorFariborz Jahanian <fjahanian@apple.com>
Tue, 4 Sep 2007 19:26:51 +0000 (19:26 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Tue, 4 Sep 2007 19:26:51 +0000 (19:26 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41709 91177308-0d34-0410-b5e6-96231b3b80d8

Parse/ParseObjc.cpp
include/clang/Parse/Parser.h

index 624932ffe4e77ca5981be0c7f4899fe5580ca6c3..62149a040ab1bbcb7c8f92296d8e91599d38ce3b 100644 (file)
@@ -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;
 }
 
index 76eab0d89817e6170eec3bec1cd533f59f4e9ac5..9d8021a24c19f0cb45849f12553bacabd641eb30 100644 (file)
@@ -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);