[cfe-commits] r39124 - in /cfe/cfe/trunk/Parse: ParseObjc.cpp Parser.cpp

sabre at cs.uiuc.edu sabre at cs.uiuc.edu
Wed Jul 11 09:27:46 PDT 2007


Author: sabre
Date: Wed Jul 11 11:27:46 2007
New Revision: 39124

URL: http://llvm.org/viewvc/llvm-project?rev=39124&view=rev
Log:
Move objc productions to their own .cpp file.

Added:
    cfe/cfe/trunk/Parse/ParseObjc.cpp   (with props)
Modified:
    cfe/cfe/trunk/Parse/Parser.cpp

Added: cfe/cfe/trunk/Parse/ParseObjc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Parse/ParseObjc.cpp?rev=39124&view=auto

==============================================================================
--- cfe/cfe/trunk/Parse/ParseObjc.cpp (added)
+++ cfe/cfe/trunk/Parse/ParseObjc.cpp Wed Jul 11 11:27:46 2007
@@ -0,0 +1,105 @@
+//===--- ParseObjc.cpp - Objective C Parsing ------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file was developed by Steve Naroff and is distributed under
+// the University of Illinois Open Source License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+//  This file implements the Objective-C portions of the Parser interface.
+//
+//===----------------------------------------------------------------------===//
+
+#include "clang/Parse/Parser.h"
+#include "clang/Basic/Diagnostic.h"
+#include "llvm/ADT/SmallVector.h"
+using namespace llvm;
+using namespace clang;
+
+
+/// ParseExternalDeclaration:
+///       external-declaration: [C99 6.9]
+/// [OBJC]  objc-class-definition
+/// [OBJC]  objc-class-declaration     [TODO]
+/// [OBJC]  objc-alias-declaration     [TODO]
+/// [OBJC]  objc-protocol-definition   [TODO]
+/// [OBJC]  objc-method-definition     [TODO]
+/// [OBJC]  '@' 'end'                  [TODO]
+void Parser::ObjCParseAtDirectives() {
+  SourceLocation AtLoc = ConsumeToken(); // the "@"
+  
+  IdentifierInfo *II = Tok.getIdentifierInfo();
+  switch (II ? II->getObjCKeywordID() : tok::objc_not_keyword) {
+    case tok::objc_class:
+      return ObjCParseAtClassDeclaration(AtLoc);
+    case tok::objc_interface:
+      return ObjCParseAtInterfaceDeclaration();
+    case tok::objc_protocol:
+      return ObjCParseAtProtocolDeclaration();
+    case tok::objc_implementation:
+      return ObjCParseAtImplementationDeclaration();
+    case tok::objc_end:
+      return ObjCParseAtEndDeclaration();
+    case tok::objc_compatibility_alias:
+      return ObjCParseAtAliasDeclaration();
+    default:
+      Diag(AtLoc, diag::err_unexpected_at);
+      SkipUntil(tok::semi);
+  }
+}
+
+///
+/// objc-class-declaration: 
+///    '@' 'class' identifier-list ';'
+///  
+void Parser::ObjCParseAtClassDeclaration(SourceLocation atLoc) {
+  ConsumeToken(); // the identifier "class"
+  SmallVector<IdentifierInfo *, 8> ClassNames;
+  
+  while (1) {
+    if (Tok.getKind() != tok::identifier) {
+      Diag(diag::err_expected_ident);
+      SkipUntil(tok::semi);
+      return;
+    }
+    
+    ClassNames.push_back(Tok.getIdentifierInfo());
+    ConsumeToken();
+    
+    if (Tok.getKind() != tok::comma)
+      break;
+    
+    ConsumeToken();
+  }
+  
+  // Consume the ';'.
+  if (ExpectAndConsume(tok::semi, diag::err_expected_semi_after, "@class"))
+    return;
+  
+  Actions.ParsedClassDeclaration(CurScope, &ClassNames[0], ClassNames.size());
+}
+
+void Parser::ObjCParseAtInterfaceDeclaration() {
+  assert(0 && "Unimp");
+}
+void Parser::ObjCParseAtProtocolDeclaration() {
+  assert(0 && "Unimp");
+}
+void Parser::ObjCParseAtImplementationDeclaration() {
+  assert(0 && "Unimp");
+}
+void Parser::ObjCParseAtEndDeclaration() {
+  assert(0 && "Unimp");
+}
+void Parser::ObjCParseAtAliasDeclaration() {
+  assert(0 && "Unimp");
+}
+
+void Parser::ObjCParseInstanceMethodDeclaration() {
+  assert(0 && "Unimp");
+}
+
+void Parser::ObjCParseClassMethodDeclaration() {
+  assert(0 && "Unimp");
+}

Propchange: cfe/cfe/trunk/Parse/ParseObjc.cpp

------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cfe/cfe/trunk/Parse/ParseObjc.cpp

------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: cfe/cfe/trunk/Parse/Parser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Parse/Parser.cpp?rev=39124&r1=39123&r2=39124&view=diff

==============================================================================
--- cfe/cfe/trunk/Parse/Parser.cpp (original)
+++ cfe/cfe/trunk/Parse/Parser.cpp Wed Jul 11 11:27:46 2007
@@ -455,88 +455,3 @@
   MatchRHSPunctuation(tok::r_paren, Loc);
 }
 
-/// ParseExternalDeclaration:
-///       external-declaration: [C99 6.9]
-/// [OBJC]  objc-class-definition
-/// [OBJC]  objc-class-declaration     [TODO]
-/// [OBJC]  objc-alias-declaration     [TODO]
-/// [OBJC]  objc-protocol-definition   [TODO]
-/// [OBJC]  objc-method-definition     [TODO]
-/// [OBJC]  '@' 'end'                  [TODO]
-void Parser::ObjCParseAtDirectives() {
-  SourceLocation AtLoc = ConsumeToken(); // the "@"
-
-  IdentifierInfo *II = Tok.getIdentifierInfo();
-  switch (II ? II->getObjCKeywordID() : tok::objc_not_keyword) {
-  case tok::objc_class:
-    return ObjCParseAtClassDeclaration(AtLoc);
-  case tok::objc_interface:
-    return ObjCParseAtInterfaceDeclaration();
-  case tok::objc_protocol:
-    return ObjCParseAtProtocolDeclaration();
-  case tok::objc_implementation:
-    return ObjCParseAtImplementationDeclaration();
-  case tok::objc_end:
-    return ObjCParseAtEndDeclaration();
-  case tok::objc_compatibility_alias:
-    return ObjCParseAtAliasDeclaration();
-  default:
-    Diag(AtLoc, diag::err_unexpected_at);
-    SkipUntil(tok::semi);
-  }
-}
-
-///
-/// objc-class-declaration: 
-///    '@' 'class' identifier-list ';'
-///  
-void Parser::ObjCParseAtClassDeclaration(SourceLocation atLoc) {
-  ConsumeToken(); // the identifier "class"
-  SmallVector<IdentifierInfo *, 8> ClassNames;
-  
-  while (1) {
-    if (Tok.getKind() != tok::identifier) {
-      Diag(diag::err_expected_ident);
-      SkipUntil(tok::semi);
-      return;
-    }
-    
-    ClassNames.push_back(Tok.getIdentifierInfo());
-    ConsumeToken();
-    
-    if (Tok.getKind() != tok::comma)
-      break;
-    
-    ConsumeToken();
-  }
-  
-  // Consume the ';'.
-  if (ExpectAndConsume(tok::semi, diag::err_expected_semi_after, "@class"))
-    return;
-  
-  Actions.ParsedClassDeclaration(CurScope, &ClassNames[0], ClassNames.size());
-}
-
-void Parser::ObjCParseAtInterfaceDeclaration() {
-  assert(0 && "Unimp");
-}
-void Parser::ObjCParseAtProtocolDeclaration() {
-  assert(0 && "Unimp");
-}
-void Parser::ObjCParseAtImplementationDeclaration() {
-  assert(0 && "Unimp");
-}
-void Parser::ObjCParseAtEndDeclaration() {
-  assert(0 && "Unimp");
-}
-void Parser::ObjCParseAtAliasDeclaration() {
-  assert(0 && "Unimp");
-}
-
-void Parser::ObjCParseInstanceMethodDeclaration() {
-  assert(0 && "Unimp");
-}
-
-void Parser::ObjCParseClassMethodDeclaration() {
-  assert(0 && "Unimp");
-}





More information about the cfe-commits mailing list