[cfe-commits] r41709 - in /cfe/trunk: Parse/ParseObjc.cpp include/clang/Parse/Parser.h

Fariborz Jahanian fjahanian at apple.com
Tue Sep 4 12:26:51 PDT 2007


Author: fjahanian
Date: Tue Sep  4 14:26:51 2007
New Revision: 41709

URL: http://llvm.org/viewvc/llvm-project?rev=41709&view=rev
Log:
Patch to parse objective-c's @compatibility_alias directive.


Modified:
    cfe/trunk/Parse/ParseObjc.cpp
    cfe/trunk/include/clang/Parse/Parser.h

Modified: cfe/trunk/Parse/ParseObjc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Parse/ParseObjc.cpp?rev=41709&r1=41708&r2=41709&view=diff

==============================================================================
--- cfe/trunk/Parse/ParseObjc.cpp (original)
+++ cfe/trunk/Parse/ParseObjc.cpp Tue Sep  4 14:26:51 2007
@@ -41,7 +41,7 @@
     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 @@
 
   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;
 }
 

Modified: cfe/trunk/include/clang/Parse/Parser.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Parser.h?rev=41709&r1=41708&r2=41709&view=diff

==============================================================================
--- cfe/trunk/include/clang/Parse/Parser.h (original)
+++ cfe/trunk/include/clang/Parse/Parser.h Tue Sep  4 14:26:51 2007
@@ -264,7 +264,7 @@
   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);
   





More information about the cfe-commits mailing list