]> granicus.if.org Git - clang/commitdiff
objc refactoring - minor clean up.
authorFariborz Jahanian <fjahanian@apple.com>
Mon, 22 Aug 2011 21:44:58 +0000 (21:44 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Mon, 22 Aug 2011 21:44:58 +0000 (21:44 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138276 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 943d3c095711308a7fbe0f09286f0c6180e72faf..1215e2daa7358735414259655d48627aff87f4b7 100644 (file)
@@ -1073,7 +1073,8 @@ private:
                                    SourceLocation &LAngleLoc,
                                    SourceLocation &EndProtoLoc);
   bool ParseObjCProtocolQualifiers(DeclSpec &DS);
-  void ParseObjCInterfaceDeclList(tok::ObjCKeywordKind contextKey);
+  void ParseObjCInterfaceDeclList(tok::ObjCKeywordKind contextKey,
+                                  Decl *CDecl);
   Decl *ParseObjCAtProtocolDeclaration(SourceLocation atLoc,
                                        ParsedAttributes &prefixAttrs);
 
index 7512bbc5ff316358caefce321fb5bbe75c695da5..684d8edf891906af8bdc3545729e2736835d7211 100644 (file)
@@ -199,9 +199,7 @@ Decl *Parser::ParseObjCAtInterfaceDeclaration(SourceLocation atLoc,
     if (Tok.is(tok::l_brace))
       ParseObjCClassInstanceVariables(CategoryType, tok::objc_private, atLoc);
       
-    Actions.ActOnObjCContainerStartDefinition(CategoryType);
-    ParseObjCInterfaceDeclList(tok::objc_not_keyword);
-    Actions.ActOnObjCContainerFinishDefinition(CategoryType);
+    ParseObjCInterfaceDeclList(tok::objc_not_keyword, CategoryType);
     return CategoryType;
   }
   // Parse a class interface.
@@ -243,9 +241,7 @@ Decl *Parser::ParseObjCAtInterfaceDeclaration(SourceLocation atLoc,
   if (Tok.is(tok::l_brace))
     ParseObjCClassInstanceVariables(ClsType, tok::objc_protected, atLoc);
 
-  Actions.ActOnObjCContainerStartDefinition(ClsType);
-  ParseObjCInterfaceDeclList(tok::objc_interface);
-  Actions.ActOnObjCContainerFinishDefinition(ClsType);
+  ParseObjCInterfaceDeclList(tok::objc_interface, ClsType);
   return ClsType;
 }
 
@@ -317,14 +313,16 @@ struct Parser::ObjCPropertyCallback : FieldCallback {
 ///     @required
 ///     @optional
 ///
-void Parser::ParseObjCInterfaceDeclList(tok::ObjCKeywordKind contextKey) {
+void Parser::ParseObjCInterfaceDeclList(tok::ObjCKeywordKind contextKey, 
+                                        Decl *CDecl) {
   SmallVector<Decl *, 32> allMethods;
   SmallVector<Decl *, 16> allProperties;
   SmallVector<DeclGroupPtrTy, 8> allTUVariables;
   tok::ObjCKeywordKind MethodImplKind = tok::objc_not_keyword;
 
   SourceRange AtEnd;
-
+  Actions.ActOnObjCContainerStartDefinition(CDecl);
+    
   while (1) {
     // If this is a method prototype, parse it.
     if (Tok.is(tok::minus) || Tok.is(tok::plus)) {
@@ -461,6 +459,7 @@ void Parser::ParseObjCInterfaceDeclList(tok::ObjCKeywordKind contextKey) {
                      allMethods.data(), allMethods.size(),
                      allProperties.data(), allProperties.size(),
                      allTUVariables.data(), allTUVariables.size());
+  Actions.ActOnObjCContainerFinishDefinition(CDecl);
 }
 
 ///   Parse property attribute declarations.
@@ -1292,10 +1291,7 @@ Decl *Parser::ParseObjCAtProtocolDeclaration(SourceLocation AtLoc,
                                         ProtocolLocs.data(),
                                         EndProtoLoc, attrs.getList());
 
-
-  Actions.ActOnObjCContainerStartDefinition(ProtoType);
-  ParseObjCInterfaceDeclList(tok::objc_protocol);
-  Actions.ActOnObjCContainerFinishDefinition(ProtoType);
+  ParseObjCInterfaceDeclList(tok::objc_protocol, ProtoType);
   return ProtoType;
 }