[cfe-commits] r42587 - in /cfe/trunk: Parse/MinimalAction.cpp Parse/ParseObjc.cpp Sema/Sema.h Sema/SemaDecl.cpp clang.xcodeproj/project.pbxproj include/clang/Parse/Action.h
Steve Naroff
snaroff at apple.com
Wed Oct 3 14:00:46 PDT 2007
Author: snaroff
Date: Wed Oct 3 16:00:46 2007
New Revision: 42587
URL: http://llvm.org/viewvc/llvm-project?rev=42587&view=rev
Log:
Finish renaming ObjC declaration actions.
Add comments.
Switch to new indentation style for the Action class. Since many actions take many arguments, the new style will...
- make it easier to add/remove arguments without messing up the indentation...
- make it easier to add comments to each argument (see ActOnMethodDeclaration for an example)...
- in general, just makes it easier to see what is being passed.
The rest of Actions will be converted "lazily"...there is no immediate need to hack all the existing methods.
Modified:
cfe/trunk/Parse/MinimalAction.cpp
cfe/trunk/Parse/ParseObjc.cpp
cfe/trunk/Sema/Sema.h
cfe/trunk/Sema/SemaDecl.cpp
cfe/trunk/clang.xcodeproj/project.pbxproj
cfe/trunk/include/clang/Parse/Action.h
Modified: cfe/trunk/Parse/MinimalAction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Parse/MinimalAction.cpp?rev=42587&r1=42586&r2=42587&view=diff
==============================================================================
--- cfe/trunk/Parse/MinimalAction.cpp (original)
+++ cfe/trunk/Parse/MinimalAction.cpp Wed Oct 3 16:00:46 2007
@@ -68,7 +68,7 @@
}
Action::DeclTy *
-MinimalAction::ObjcStartClassInterface(Scope* S, SourceLocation AtInterafceLoc,
+MinimalAction::ActOnStartClassInterface(Scope* S, SourceLocation AtInterafceLoc,
IdentifierInfo *ClassName, SourceLocation ClassLoc,
IdentifierInfo *SuperName, SourceLocation SuperLoc,
IdentifierInfo **ProtocolNames, unsigned NumProtocols,
@@ -81,7 +81,7 @@
}
Action::DeclTy *
-MinimalAction::ObjcStartProtoInterface(Scope* S,
+MinimalAction::ActOnStartProtocolInterface(Scope* S,
SourceLocation AtProtoInterfaceLoc,
IdentifierInfo *ProtocolName, SourceLocation ProtocolLoc,
IdentifierInfo **ProtoRefNames, unsigned NumProtoRefs) {
Modified: cfe/trunk/Parse/ParseObjc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Parse/ParseObjc.cpp?rev=42587&r1=42586&r2=42587&view=diff
==============================================================================
--- cfe/trunk/Parse/ParseObjc.cpp (original)
+++ cfe/trunk/Parse/ParseObjc.cpp Wed Oct 3 16:00:46 2007
@@ -154,11 +154,9 @@
if (attrList) // categories don't support attributes.
Diag(Tok, diag::err_objc_no_attributes_on_category);
- DeclTy *CategoryType = Actions.ObjcStartCatInterface(CurScope, atLoc,
- nameId, nameLoc,
- categoryId, categoryLoc,
- &ProtocolRefs[0],
- ProtocolRefs.size());
+ DeclTy *CategoryType = Actions.ActOnStartCategoryInterface(CurScope, atLoc,
+ nameId, nameLoc, categoryId, categoryLoc,
+ &ProtocolRefs[0], ProtocolRefs.size());
ParseObjCInterfaceDeclList(CategoryType, tok::objc_not_keyword);
@@ -189,7 +187,7 @@
if (ParseObjCProtocolReferences(ProtocolRefs))
return 0;
}
- DeclTy *ClsType = Actions.ObjcStartClassInterface(CurScope,
+ DeclTy *ClsType = Actions.ActOnStartClassInterface(CurScope,
atLoc, nameId, nameLoc,
superClassId, superClassLoc, &ProtocolRefs[0],
ProtocolRefs.size(), attrList);
@@ -268,8 +266,8 @@
}
}
/// Insert collected methods declarations into the @interface object.
- Actions.ObjcAddMethodsToClass(CurScope,
- interfaceDecl,&allMethods[0],allMethods.size());
+ Actions.ActOnAddMethodsToObjcDecl(CurScope, interfaceDecl,
+ &allMethods[0], allMethods.size());
}
/// Parse property attribute declarations.
@@ -875,7 +873,7 @@
return 0;
}
- DeclTy *ProtoType = Actions.ObjcStartProtoInterface(CurScope, AtLoc,
+ DeclTy *ProtoType = Actions.ActOnStartProtocolInterface(CurScope, AtLoc,
protocolName, nameLoc,
&ProtocolRefs[0],
ProtocolRefs.size());
@@ -934,7 +932,7 @@
return 0;
}
rparenLoc = ConsumeParen();
- DeclTy *ImplCatType = Actions.ObjcStartCategoryImplementation(CurScope,
+ DeclTy *ImplCatType = Actions.ActOnStartCategoryImplementation(CurScope,
atLoc, nameId, nameLoc, categoryId,
categoryLoc);
return ImplCatType;
@@ -952,9 +950,8 @@
superClassId = Tok.getIdentifierInfo();
superClassLoc = ConsumeToken(); // Consume super class name
}
- DeclTy *ImplClsType = Actions.ObjcStartClassImplementation(CurScope,
- atLoc,
- nameId, nameLoc,
+ DeclTy *ImplClsType = Actions.ActOnStartClassImplementation(CurScope,
+ atLoc, nameId, nameLoc,
superClassId, superClassLoc);
if (Tok.getKind() == tok::l_brace)
@@ -971,8 +968,8 @@
// @implementation not to have been parsed to completion and ObjcImpDecl
// could be 0.
/// Insert collected methods declarations into the @interface object.
- Actions.ObjcAddMethodsToClass(CurScope, ObjcImpDecl,
- &AllImplMethods[0],AllImplMethods.size());
+ Actions.ActOnAddMethodsToObjcDecl(CurScope, ObjcImpDecl,
+ &AllImplMethods[0],AllImplMethods.size());
ObjcImpDecl = 0;
AllImplMethods.clear();
}
Modified: cfe/trunk/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/Sema.h?rev=42587&r1=42586&r2=42587&view=diff
==============================================================================
--- cfe/trunk/Sema/Sema.h (original)
+++ cfe/trunk/Sema/Sema.h Wed Oct 3 16:00:46 2007
@@ -384,31 +384,31 @@
SourceLocation RParenLoc);
// Objective-C declarations.
- virtual DeclTy *ObjcStartClassInterface(Scope* S,
+ virtual DeclTy *ActOnStartClassInterface(Scope* S,
SourceLocation AtInterafceLoc,
IdentifierInfo *ClassName, SourceLocation ClassLoc,
IdentifierInfo *SuperName, SourceLocation SuperLoc,
IdentifierInfo **ProtocolNames, unsigned NumProtocols,
AttributeList *AttrList);
- virtual DeclTy *ObjcStartProtoInterface(Scope* S,
+ virtual DeclTy *ActOnStartProtocolInterface(Scope* S,
SourceLocation AtProtoInterfaceLoc,
IdentifierInfo *ProtocolName, SourceLocation ProtocolLoc,
IdentifierInfo **ProtoRefNames, unsigned NumProtoRefs);
- virtual DeclTy *ObjcStartCatInterface(Scope* S,
+ virtual DeclTy *ActOnStartCategoryInterface(Scope* S,
SourceLocation AtInterfaceLoc,
IdentifierInfo *ClassName, SourceLocation ClassLoc,
IdentifierInfo *CategoryName, SourceLocation CategoryLoc,
IdentifierInfo **ProtoRefNames, unsigned NumProtoRefs);
- virtual DeclTy *ObjcStartClassImplementation(Scope* S,
+ virtual DeclTy *ActOnStartClassImplementation(Scope* S,
SourceLocation AtClassImplLoc,
IdentifierInfo *ClassName, SourceLocation ClassLoc,
IdentifierInfo *SuperClassname,
SourceLocation SuperClassLoc);
- virtual DeclTy *ObjcStartCategoryImplementation(Scope* S,
+ virtual DeclTy *ActOnStartCategoryImplementation(Scope* S,
SourceLocation AtCatImplLoc,
IdentifierInfo *ClassName,
SourceLocation ClassLoc,
@@ -424,8 +424,8 @@
IdentifierInfo **IdentList,
unsigned NumElts);
- virtual void ObjcAddMethodsToClass(Scope* S, DeclTy *ClassDecl,
- DeclTy **allMethods, unsigned allNum);
+ virtual void ActOnAddMethodsToObjcDecl(Scope* S, DeclTy *ClassDecl,
+ DeclTy **allMethods, unsigned allNum);
virtual DeclTy *ActOnMethodDeclaration(SourceLocation MethodLoc,
tok::TokenKind MethodType, TypeTy *ReturnType, Selector Sel,
Modified: cfe/trunk/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaDecl.cpp?rev=42587&r1=42586&r2=42587&view=diff
==============================================================================
--- cfe/trunk/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/Sema/SemaDecl.cpp Wed Oct 3 16:00:46 2007
@@ -894,7 +894,7 @@
return NewTD;
}
-Sema::DeclTy *Sema::ObjcStartClassInterface(Scope* S,
+Sema::DeclTy *Sema::ActOnStartClassInterface(Scope* S,
SourceLocation AtInterfaceLoc,
IdentifierInfo *ClassName, SourceLocation ClassLoc,
IdentifierInfo *SuperName, SourceLocation SuperLoc,
@@ -967,7 +967,7 @@
return IDecl;
}
-Sema::DeclTy *Sema::ObjcStartProtoInterface(Scope* S,
+Sema::DeclTy *Sema::ActOnStartProtocolInterface(Scope* S,
SourceLocation AtProtoInterfaceLoc,
IdentifierInfo *ProtocolName, SourceLocation ProtocolLoc,
IdentifierInfo **ProtoRefNames, unsigned NumProtoRefs) {
@@ -1031,7 +1031,7 @@
return FDecl;
}
-Sema::DeclTy *Sema::ObjcStartCatInterface(Scope* S,
+Sema::DeclTy *Sema::ActOnStartCategoryInterface(Scope* S,
SourceLocation AtInterfaceLoc,
IdentifierInfo *ClassName, SourceLocation ClassLoc,
IdentifierInfo *CategoryName, SourceLocation CategoryLoc,
@@ -1075,10 +1075,10 @@
return CDecl;
}
-/// ObjcStartCategoryImplementation - Perform semantic checks on the
+/// ActOnStartCategoryImplementation - Perform semantic checks on the
/// category implementation declaration and build an ObjcCategoryImplDecl
/// object.
-Sema::DeclTy *Sema::ObjcStartCategoryImplementation(Scope* S,
+Sema::DeclTy *Sema::ActOnStartCategoryImplementation(Scope* S,
SourceLocation AtCatImplLoc,
IdentifierInfo *ClassName, SourceLocation ClassLoc,
IdentifierInfo *CatName, SourceLocation CatLoc) {
@@ -1094,7 +1094,7 @@
return CDecl;
}
-Sema::DeclTy *Sema::ObjcStartClassImplementation(Scope *S,
+Sema::DeclTy *Sema::ActOnStartClassImplementation(Scope *S,
SourceLocation AtClassImplLoc,
IdentifierInfo *ClassName, SourceLocation ClassLoc,
IdentifierInfo *SuperClassname,
@@ -1683,8 +1683,8 @@
}
}
-void Sema::ObjcAddMethodsToClass(Scope* S, DeclTy *ClassDecl,
- DeclTy **allMethods, unsigned allNum) {
+void Sema::ActOnAddMethodsToObjcDecl(Scope* S, DeclTy *ClassDecl,
+ DeclTy **allMethods, unsigned allNum) {
// FIXME: Fix this when we can handle methods declared in protocols.
// See Parser::ParseObjCAtProtocolDeclaration
if (!ClassDecl)
@@ -1747,7 +1747,7 @@
}
}
else
- assert(0 && "Sema::ObjcAddMethodsToClass(): Unknown DeclTy");
+ assert(0 && "Sema::ActOnAddMethodsToObjcDecl(): Unknown DeclTy");
return;
}
Modified: cfe/trunk/clang.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/clang.xcodeproj/project.pbxproj?rev=42587&r1=42586&r2=42587&view=diff
==============================================================================
--- cfe/trunk/clang.xcodeproj/project.pbxproj (original)
+++ cfe/trunk/clang.xcodeproj/project.pbxproj Wed Oct 3 16:00:46 2007
@@ -737,7 +737,6 @@
08FB7793FE84155DC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "clang" */;
- compatibilityVersion = "Xcode 2.4";
hasScannedForEncodings = 1;
mainGroup = 08FB7794FE84155DC02AAC07 /* clang */;
projectDirPath = "";
Modified: cfe/trunk/include/clang/Parse/Action.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Action.h?rev=42587&r1=42586&r2=42587&view=diff
==============================================================================
--- cfe/trunk/include/clang/Parse/Action.h (original)
+++ cfe/trunk/include/clang/Parse/Action.h Wed Oct 3 16:00:46 2007
@@ -437,59 +437,99 @@
}
//===----------------------- Obj-C Declarations -------------------------===//
- virtual DeclTy *ObjcStartClassInterface(Scope* S, SourceLocation AtInterafceLoc,
- IdentifierInfo *ClassName, SourceLocation ClassLoc,
- IdentifierInfo *SuperName, SourceLocation SuperLoc,
- IdentifierInfo **ProtocolNames, unsigned NumProtocols,
- AttributeList *AttrList) {
- return 0;
- }
- virtual void ObjcAddMethodsToClass(Scope* S, DeclTy *ClassDecl,
- DeclTy **allMethods, unsigned allNum) {
- return;
- }
- virtual DeclTy *ObjcStartProtoInterface(Scope* S,
- SourceLocation AtProtoInterfaceLoc,
- IdentifierInfo *ProtocolName, SourceLocation ProtocolLoc,
- IdentifierInfo **ProtoRefNames, unsigned NumProtoRefs) {
- return 0;
- }
- virtual DeclTy *ObjcStartCatInterface(Scope* S,
- SourceLocation AtInterfaceLoc,
- IdentifierInfo *ClassName, SourceLocation ClassLoc,
- IdentifierInfo *CategoryName, SourceLocation CategoryLoc,
- IdentifierInfo **ProtoRefNames, unsigned NumProtoRefs) {
- return 0;
- }
- virtual DeclTy *ObjcStartClassImplementation(Scope* S,
- SourceLocation AtClassImplLoc,
- IdentifierInfo *ClassName, SourceLocation ClassLoc,
- IdentifierInfo *SuperClassname,
- SourceLocation SuperClassLoc) {
- return 0;
- }
- virtual DeclTy *ObjcStartCategoryImplementation(Scope* S,
- SourceLocation AtCatImplLoc,
- IdentifierInfo *ClassName,
- SourceLocation ClassLoc,
- IdentifierInfo *CatName,
- SourceLocation CatLoc) {
+ // ActOnStartClassInterface - this action is called immdiately after parsing
+ // the prologue for a class interface (before parsing the instance
+ // variables). Instance variables are processed by ActOnFields().
+ virtual DeclTy *ActOnStartClassInterface(
+ Scope* S,
+ SourceLocation AtInterafceLoc,
+ IdentifierInfo *ClassName,
+ SourceLocation ClassLoc,
+ IdentifierInfo *SuperName,
+ SourceLocation SuperLoc,
+ IdentifierInfo **ProtocolNames,
+ unsigned NumProtocols,
+ AttributeList *AttrList) {
+ return 0;
+ }
+ // ActOnStartProtocolInterface - this action is called immdiately after
+ // parsing the prologue for a protocol interface.
+ virtual DeclTy *ActOnStartProtocolInterface(
+ Scope* S,
+ SourceLocation AtProtoInterfaceLoc,
+ IdentifierInfo *ProtocolName,
+ SourceLocation ProtocolLoc,
+ IdentifierInfo **ProtoRefNames,
+ unsigned NumProtoRefs) {
+ return 0;
+ }
+ // ActOnStartCategoryInterface - this action is called immdiately after
+ // parsing the prologue for a category interface.
+ virtual DeclTy *ActOnStartCategoryInterface(
+ Scope* S,
+ SourceLocation AtInterfaceLoc,
+ IdentifierInfo *ClassName,
+ SourceLocation ClassLoc,
+ IdentifierInfo *CategoryName,
+ SourceLocation CategoryLoc,
+ IdentifierInfo **ProtoRefNames,
+ unsigned NumProtoRefs) {
+ return 0;
+ }
+ // ActOnStartClassImplementation - this action is called immdiately after
+ // parsing the prologue for a class implementation. Instance variables are
+ // processed by ActOnFields().
+ virtual DeclTy *ActOnStartClassImplementation(
+ Scope* S,
+ SourceLocation AtClassImplLoc,
+ IdentifierInfo *ClassName,
+ SourceLocation ClassLoc,
+ IdentifierInfo *SuperClassname,
+ SourceLocation SuperClassLoc) {
+ return 0;
+ }
+ // ActOnStartCategoryImplementation - this action is called immdiately after
+ // parsing the prologue for a category implementation.
+ virtual DeclTy *ActOnStartCategoryImplementation(
+ Scope* S,
+ SourceLocation AtCatImplLoc,
+ IdentifierInfo *ClassName,
+ SourceLocation ClassLoc,
+ IdentifierInfo *CatName,
+ SourceLocation CatLoc) {
return 0;
}
- virtual DeclTy *ActOnMethodDeclaration(SourceLocation MethodLoc,
- tok::TokenKind MethodType, TypeTy *ReturnType, Selector Sel,
- // optional arguments. The number of types/arguments is obtained
- // from the Sel.getNumArgs().
- TypeTy **ArgTypes, IdentifierInfo **ArgNames,
- AttributeList *AttrList, tok::ObjCKeywordKind MethodImplKind) {
- return 0;
+ // ActOnMethodDeclaration - called for all method declarations.
+ virtual DeclTy *ActOnMethodDeclaration(
+ SourceLocation MethodLoc,
+ tok::TokenKind MethodType, // tok::minus for instance, tok::plus for class.
+ TypeTy *ReturnType, // the method return type.
+ Selector Sel, // a unique name for the method.
+ TypeTy **ArgTypes, // non-zero when Sel.getNumArgs() > 0
+ IdentifierInfo **ArgNames, // non-zero when Sel.getNumArgs() > 0
+ AttributeList *AttrList, // optional
+ // tok::objc_not_keyword, tok::objc_optional, tok::objc_required
+ tok::ObjCKeywordKind impKind) {
+ return 0;
+ }
+ // ActOnAddMethodsToObjcDecl - called to associate methods with an interface,
+ // protocol, category, or implementation.
+ virtual void ActOnAddMethodsToObjcDecl(
+ Scope* S,
+ DeclTy *ClassDecl,
+ DeclTy **allMethods,
+ unsigned allNum) {
+ return;
}
// ActOnClassMessage - used for both unary and keyword messages.
// ArgExprs is optional - if it is present, the number of expressions
// is obtained from Sel.getNumArgs().
virtual ExprResult ActOnClassMessage(
- IdentifierInfo *receivingClassName, Selector Sel,
- SourceLocation lbrac, SourceLocation rbrac, ExprTy **ArgExprs) {
+ IdentifierInfo *receivingClassName,
+ Selector Sel,
+ SourceLocation lbrac,
+ SourceLocation rbrac,
+ ExprTy **ArgExprs) {
return 0;
}
// ActOnInstanceMessage - used for both unary and keyword messages.
@@ -500,17 +540,18 @@
SourceLocation lbrac, SourceLocation rbrac, ExprTy **ArgExprs) {
return 0;
}
- virtual DeclTy *ActOnForwardClassDeclaration(Scope *S,
- SourceLocation AtClassLoc,
- IdentifierInfo **IdentList,
- unsigned NumElts) {
+ virtual DeclTy *ActOnForwardClassDeclaration(
+ Scope *S,
+ SourceLocation AtClassLoc,
+ IdentifierInfo **IdentList,
+ unsigned NumElts) {
return 0;
}
-
- virtual DeclTy *ActOnForwardProtocolDeclaration(Scope *S,
- SourceLocation AtProtocolLoc,
- IdentifierInfo **IdentList,
- unsigned NumElts) {
+ virtual DeclTy *ActOnForwardProtocolDeclaration(
+ Scope *S,
+ SourceLocation AtProtocolLoc,
+ IdentifierInfo **IdentList,
+ unsigned NumElts) {
return 0;
}
@@ -559,12 +600,12 @@
IdentifierInfo **IdentList,
unsigned NumElts);
- virtual DeclTy *ObjcStartClassInterface(Scope* S, SourceLocation AtInterafceLoc,
+ virtual DeclTy *ActOnStartClassInterface(Scope* S, SourceLocation AtInterafceLoc,
IdentifierInfo *ClassName, SourceLocation ClassLoc,
IdentifierInfo *SuperName, SourceLocation SuperLoc,
IdentifierInfo **ProtocolNames, unsigned NumProtocols,
AttributeList *AttrList);
- virtual DeclTy *ObjcStartProtoInterface(Scope *S,
+ virtual DeclTy *ActOnStartProtocolInterface(Scope *S,
SourceLocation AtProtoInterfaceLoc,
IdentifierInfo *ProtocolName, SourceLocation ProtocolLoc,
IdentifierInfo **ProtoRefNames, unsigned NumProtoRefs);
More information about the cfe-commits
mailing list