Remove Scope argument from ObjC actions that either don't need it or can now use TUScope.

Also improve a recently added comment.

llvm-svn: 42826
This commit is contained in:
Steve Naroff 2007-10-10 17:32:04 +00:00
parent 0818f6e7e4
commit 93eb5f1438
6 changed files with 45 additions and 52 deletions

View File

@ -68,7 +68,7 @@ MinimalAction::ActOnDeclarator(Scope *S, Declarator &D, DeclTy *LastInGroup) {
} }
Action::DeclTy * Action::DeclTy *
MinimalAction::ActOnStartClassInterface(Scope* S, SourceLocation AtInterafceLoc, MinimalAction::ActOnStartClassInterface(SourceLocation AtInterafceLoc,
IdentifierInfo *ClassName, SourceLocation ClassLoc, IdentifierInfo *ClassName, SourceLocation ClassLoc,
IdentifierInfo *SuperName, SourceLocation SuperLoc, IdentifierInfo *SuperName, SourceLocation SuperLoc,
IdentifierInfo **ProtocolNames, unsigned NumProtocols, IdentifierInfo **ProtocolNames, unsigned NumProtocols,
@ -83,7 +83,7 @@ MinimalAction::ActOnStartClassInterface(Scope* S, SourceLocation AtInterafceLoc,
/// ActOnForwardClassDeclaration - /// ActOnForwardClassDeclaration -
/// Scope will always be top level file scope. /// Scope will always be top level file scope.
Action::DeclTy * Action::DeclTy *
MinimalAction::ActOnForwardClassDeclaration(Scope *S, SourceLocation AtClassLoc, MinimalAction::ActOnForwardClassDeclaration(SourceLocation AtClassLoc,
IdentifierInfo **IdentList, unsigned NumElts) { IdentifierInfo **IdentList, unsigned NumElts) {
for (unsigned i = 0; i != NumElts; ++i) { for (unsigned i = 0; i != NumElts; ++i) {
TypeNameInfo *TI = TypeNameInfo *TI =
@ -92,7 +92,7 @@ MinimalAction::ActOnForwardClassDeclaration(Scope *S, SourceLocation AtClassLoc,
IdentList[i]->setFETokenInfo(TI); IdentList[i]->setFETokenInfo(TI);
// Remember that this needs to be removed when the scope is popped. // Remember that this needs to be removed when the scope is popped.
S->AddDecl(IdentList[i]); TUScope->AddDecl(IdentList[i]);
} }
return 0; return 0;
} }

View File

@ -409,8 +409,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS) {
if (Tok.is(tok::less)) { if (Tok.is(tok::less)) {
llvm::SmallVector<IdentifierInfo *, 8> ProtocolRefs; llvm::SmallVector<IdentifierInfo *, 8> ProtocolRefs;
ParseObjCProtocolReferences(ProtocolRefs); ParseObjCProtocolReferences(ProtocolRefs);
Actions.ActOnFindProtocolDeclaration(CurScope, Actions.ActOnFindProtocolDeclaration(Loc,
Loc,
&ProtocolRefs[0], &ProtocolRefs[0],
ProtocolRefs.size()); ProtocolRefs.size());
} }

View File

@ -80,7 +80,7 @@ Parser::DeclTy *Parser::ParseObjCAtClassDeclaration(SourceLocation atLoc) {
if (ExpectAndConsume(tok::semi, diag::err_expected_semi_after, "@class")) if (ExpectAndConsume(tok::semi, diag::err_expected_semi_after, "@class"))
return 0; return 0;
return Actions.ActOnForwardClassDeclaration(CurScope, atLoc, return Actions.ActOnForwardClassDeclaration(atLoc,
&ClassNames[0], ClassNames.size()); &ClassNames[0], ClassNames.size());
} }
@ -154,7 +154,7 @@ Parser::DeclTy *Parser::ParseObjCAtInterfaceDeclaration(
if (attrList) // categories don't support attributes. if (attrList) // categories don't support attributes.
Diag(Tok, diag::err_objc_no_attributes_on_category); Diag(Tok, diag::err_objc_no_attributes_on_category);
DeclTy *CategoryType = Actions.ActOnStartCategoryInterface(CurScope, atLoc, DeclTy *CategoryType = Actions.ActOnStartCategoryInterface(atLoc,
nameId, nameLoc, categoryId, categoryLoc, nameId, nameLoc, categoryId, categoryLoc,
&ProtocolRefs[0], ProtocolRefs.size()); &ProtocolRefs[0], ProtocolRefs.size());
@ -187,7 +187,7 @@ Parser::DeclTy *Parser::ParseObjCAtInterfaceDeclaration(
if (ParseObjCProtocolReferences(ProtocolRefs)) if (ParseObjCProtocolReferences(ProtocolRefs))
return 0; return 0;
} }
DeclTy *ClsType = Actions.ActOnStartClassInterface(CurScope, DeclTy *ClsType = Actions.ActOnStartClassInterface(
atLoc, nameId, nameLoc, atLoc, nameId, nameLoc,
superClassId, superClassLoc, &ProtocolRefs[0], superClassId, superClassLoc, &ProtocolRefs[0],
ProtocolRefs.size(), attrList); ProtocolRefs.size(), attrList);
@ -799,7 +799,7 @@ Parser::DeclTy *Parser::ParseObjCAtProtocolDeclaration(SourceLocation AtLoc) {
return 0; return 0;
} }
if (ProtocolRefs.size() > 0) if (ProtocolRefs.size() > 0)
return Actions.ActOnForwardProtocolDeclaration(CurScope, AtLoc, return Actions.ActOnForwardProtocolDeclaration(AtLoc,
&ProtocolRefs[0], &ProtocolRefs[0],
ProtocolRefs.size()); ProtocolRefs.size());
// Last, and definitely not least, parse a protocol declaration. // Last, and definitely not least, parse a protocol declaration.
@ -808,7 +808,7 @@ Parser::DeclTy *Parser::ParseObjCAtProtocolDeclaration(SourceLocation AtLoc) {
return 0; return 0;
} }
DeclTy *ProtoType = Actions.ActOnStartProtocolInterface(CurScope, AtLoc, DeclTy *ProtoType = Actions.ActOnStartProtocolInterface(AtLoc,
protocolName, nameLoc, protocolName, nameLoc,
&ProtocolRefs[0], &ProtocolRefs[0],
ProtocolRefs.size()); ProtocolRefs.size());
@ -867,7 +867,7 @@ Parser::DeclTy *Parser::ParseObjCAtImplementationDeclaration(
return 0; return 0;
} }
rparenLoc = ConsumeParen(); rparenLoc = ConsumeParen();
DeclTy *ImplCatType = Actions.ActOnStartCategoryImplementation(CurScope, DeclTy *ImplCatType = Actions.ActOnStartCategoryImplementation(
atLoc, nameId, nameLoc, categoryId, atLoc, nameId, nameLoc, categoryId,
categoryLoc); categoryLoc);
return ImplCatType; return ImplCatType;
@ -885,7 +885,7 @@ Parser::DeclTy *Parser::ParseObjCAtImplementationDeclaration(
superClassId = Tok.getIdentifierInfo(); superClassId = Tok.getIdentifierInfo();
superClassLoc = ConsumeToken(); // Consume super class name superClassLoc = ConsumeToken(); // Consume super class name
} }
DeclTy *ImplClsType = Actions.ActOnStartClassImplementation(CurScope, DeclTy *ImplClsType = Actions.ActOnStartClassImplementation(
atLoc, nameId, nameLoc, atLoc, nameId, nameLoc,
superClassId, superClassLoc); superClassId, superClassLoc);

View File

@ -113,8 +113,9 @@ class Sema : public Action {
/// This list is populated upon the creation of a Sema object. /// This list is populated upon the creation of a Sema object.
IdentifierInfo* KnownFunctionIDs[ id_num_known_functions ]; IdentifierInfo* KnownFunctionIDs[ id_num_known_functions ];
/// Translation Unit Scope - useful to many Objective-C actions that need /// Translation Unit Scope - useful to Objective-C actions that need
/// to lookup file scope declarations (like classes, protocols, etc.). /// to lookup file scope declarations in the "ordinary" C decl namespace.
/// For example, user-defined classes, built-in "id" type, etc.
Scope *TUScope; Scope *TUScope;
public: public:
Sema(Preprocessor &pp, ASTContext &ctxt, std::vector<Decl*> &prevInGroup); Sema(Preprocessor &pp, ASTContext &ctxt, std::vector<Decl*> &prevInGroup);
@ -403,48 +404,46 @@ public:
SourceLocation RParenLoc); SourceLocation RParenLoc);
// Objective-C declarations. // Objective-C declarations.
virtual DeclTy *ActOnStartClassInterface(Scope* S, virtual DeclTy *ActOnStartClassInterface(
SourceLocation AtInterafceLoc, SourceLocation AtInterafceLoc,
IdentifierInfo *ClassName, SourceLocation ClassLoc, IdentifierInfo *ClassName, SourceLocation ClassLoc,
IdentifierInfo *SuperName, SourceLocation SuperLoc, IdentifierInfo *SuperName, SourceLocation SuperLoc,
IdentifierInfo **ProtocolNames, unsigned NumProtocols, IdentifierInfo **ProtocolNames, unsigned NumProtocols,
AttributeList *AttrList); AttributeList *AttrList);
virtual DeclTy *ActOnStartProtocolInterface(Scope* S, virtual DeclTy *ActOnStartProtocolInterface(
SourceLocation AtProtoInterfaceLoc, SourceLocation AtProtoInterfaceLoc,
IdentifierInfo *ProtocolName, SourceLocation ProtocolLoc, IdentifierInfo *ProtocolName, SourceLocation ProtocolLoc,
IdentifierInfo **ProtoRefNames, unsigned NumProtoRefs); IdentifierInfo **ProtoRefNames, unsigned NumProtoRefs);
virtual DeclTy *ActOnStartCategoryInterface(Scope* S, virtual DeclTy *ActOnStartCategoryInterface(
SourceLocation AtInterfaceLoc, SourceLocation AtInterfaceLoc,
IdentifierInfo *ClassName, SourceLocation ClassLoc, IdentifierInfo *ClassName, SourceLocation ClassLoc,
IdentifierInfo *CategoryName, SourceLocation CategoryLoc, IdentifierInfo *CategoryName, SourceLocation CategoryLoc,
IdentifierInfo **ProtoRefNames, unsigned NumProtoRefs); IdentifierInfo **ProtoRefNames, unsigned NumProtoRefs);
virtual DeclTy *ActOnStartClassImplementation(Scope* S, virtual DeclTy *ActOnStartClassImplementation(
SourceLocation AtClassImplLoc, SourceLocation AtClassImplLoc,
IdentifierInfo *ClassName, SourceLocation ClassLoc, IdentifierInfo *ClassName, SourceLocation ClassLoc,
IdentifierInfo *SuperClassname, IdentifierInfo *SuperClassname,
SourceLocation SuperClassLoc); SourceLocation SuperClassLoc);
virtual DeclTy *ActOnStartCategoryImplementation(Scope* S, virtual DeclTy *ActOnStartCategoryImplementation(
SourceLocation AtCatImplLoc, SourceLocation AtCatImplLoc,
IdentifierInfo *ClassName, IdentifierInfo *ClassName,
SourceLocation ClassLoc, SourceLocation ClassLoc,
IdentifierInfo *CatName, IdentifierInfo *CatName,
SourceLocation CatLoc); SourceLocation CatLoc);
virtual DeclTy *ActOnForwardClassDeclaration(Scope *S, SourceLocation Loc, virtual DeclTy *ActOnForwardClassDeclaration(SourceLocation Loc,
IdentifierInfo **IdentList, IdentifierInfo **IdentList,
unsigned NumElts); unsigned NumElts);
virtual DeclTy *ActOnForwardProtocolDeclaration(Scope *S, virtual DeclTy *ActOnForwardProtocolDeclaration(SourceLocation AtProtocolLoc,
SourceLocation AtProtocolLoc,
IdentifierInfo **IdentList, IdentifierInfo **IdentList,
unsigned NumElts); unsigned NumElts);
virtual DeclTy **ActOnFindProtocolDeclaration(Scope *S, virtual DeclTy **ActOnFindProtocolDeclaration(SourceLocation TypeLoc,
SourceLocation TypeLoc,
IdentifierInfo **ProtocolId, IdentifierInfo **ProtocolId,
unsigned NumProtocols); unsigned NumProtocols);

View File

@ -881,7 +881,7 @@ TypedefDecl *Sema::ParseTypedefDecl(Scope *S, Declarator &D,
return NewTD; return NewTD;
} }
Sema::DeclTy *Sema::ActOnStartClassInterface(Scope* S, Sema::DeclTy *Sema::ActOnStartClassInterface(
SourceLocation AtInterfaceLoc, SourceLocation AtInterfaceLoc,
IdentifierInfo *ClassName, SourceLocation ClassLoc, IdentifierInfo *ClassName, SourceLocation ClassLoc,
IdentifierInfo *SuperName, SourceLocation SuperLoc, IdentifierInfo *SuperName, SourceLocation SuperLoc,
@ -891,7 +891,7 @@ Sema::DeclTy *Sema::ActOnStartClassInterface(Scope* S,
// Check for another declaration kind with the same name. // Check for another declaration kind with the same name.
ScopedDecl *PrevDecl = LookupScopedDecl(ClassName, Decl::IDNS_Ordinary, ScopedDecl *PrevDecl = LookupScopedDecl(ClassName, Decl::IDNS_Ordinary,
ClassLoc, S); ClassLoc, TUScope);
if (PrevDecl && !isa<ObjcInterfaceDecl>(PrevDecl)) { if (PrevDecl && !isa<ObjcInterfaceDecl>(PrevDecl)) {
Diag(ClassLoc, diag::err_redefinition_different_kind, Diag(ClassLoc, diag::err_redefinition_different_kind,
ClassName->getName()); ClassName->getName());
@ -920,7 +920,7 @@ Sema::DeclTy *Sema::ActOnStartClassInterface(Scope* S,
ObjcInterfaceDecl* SuperClassEntry = 0; ObjcInterfaceDecl* SuperClassEntry = 0;
// Check if a different kind of symbol declared in this scope. // Check if a different kind of symbol declared in this scope.
PrevDecl = LookupScopedDecl(SuperName, Decl::IDNS_Ordinary, PrevDecl = LookupScopedDecl(SuperName, Decl::IDNS_Ordinary,
SuperLoc, S); SuperLoc, TUScope);
if (PrevDecl && !isa<ObjcInterfaceDecl>(PrevDecl)) { if (PrevDecl && !isa<ObjcInterfaceDecl>(PrevDecl)) {
Diag(SuperLoc, diag::err_redefinition_different_kind, Diag(SuperLoc, diag::err_redefinition_different_kind,
SuperName->getName()); SuperName->getName());
@ -951,7 +951,7 @@ Sema::DeclTy *Sema::ActOnStartClassInterface(Scope* S,
return IDecl; return IDecl;
} }
Sema::DeclTy *Sema::ActOnStartProtocolInterface(Scope* S, Sema::DeclTy *Sema::ActOnStartProtocolInterface(
SourceLocation AtProtoInterfaceLoc, SourceLocation AtProtoInterfaceLoc,
IdentifierInfo *ProtocolName, SourceLocation ProtocolLoc, IdentifierInfo *ProtocolName, SourceLocation ProtocolLoc,
IdentifierInfo **ProtoRefNames, unsigned NumProtoRefs) { IdentifierInfo **ProtoRefNames, unsigned NumProtoRefs) {
@ -990,8 +990,7 @@ Sema::DeclTy *Sema::ActOnStartProtocolInterface(Scope* S,
/// declared protocol and returns it. If not found, issues diagnostic. /// declared protocol and returns it. If not found, issues diagnostic.
/// Will build a list of previously protocol declarations found in the list. /// Will build a list of previously protocol declarations found in the list.
Action::DeclTy ** Action::DeclTy **
Sema::ActOnFindProtocolDeclaration(Scope *S, Sema::ActOnFindProtocolDeclaration(SourceLocation TypeLoc,
SourceLocation TypeLoc,
IdentifierInfo **ProtocolId, IdentifierInfo **ProtocolId,
unsigned NumProtocols) { unsigned NumProtocols) {
for (unsigned i = 0; i != NumProtocols; ++i) { for (unsigned i = 0; i != NumProtocols; ++i) {
@ -1004,9 +1003,8 @@ Sema::ActOnFindProtocolDeclaration(Scope *S,
} }
/// ActOnForwardProtocolDeclaration - /// ActOnForwardProtocolDeclaration -
/// Scope will always be top level file scope.
Action::DeclTy * Action::DeclTy *
Sema::ActOnForwardProtocolDeclaration(Scope *S, SourceLocation AtProtocolLoc, Sema::ActOnForwardProtocolDeclaration(SourceLocation AtProtocolLoc,
IdentifierInfo **IdentList, unsigned NumElts) { IdentifierInfo **IdentList, unsigned NumElts) {
llvm::SmallVector<ObjcProtocolDecl*, 32> Protocols; llvm::SmallVector<ObjcProtocolDecl*, 32> Protocols;
@ -1025,7 +1023,7 @@ Sema::ActOnForwardProtocolDeclaration(Scope *S, SourceLocation AtProtocolLoc,
&Protocols[0], Protocols.size()); &Protocols[0], Protocols.size());
} }
Sema::DeclTy *Sema::ActOnStartCategoryInterface(Scope* S, Sema::DeclTy *Sema::ActOnStartCategoryInterface(
SourceLocation AtInterfaceLoc, SourceLocation AtInterfaceLoc,
IdentifierInfo *ClassName, SourceLocation ClassLoc, IdentifierInfo *ClassName, SourceLocation ClassLoc,
IdentifierInfo *CategoryName, SourceLocation CategoryLoc, IdentifierInfo *CategoryName, SourceLocation CategoryLoc,
@ -1070,7 +1068,7 @@ Sema::DeclTy *Sema::ActOnStartCategoryInterface(Scope* S,
/// ActOnStartCategoryImplementation - Perform semantic checks on the /// ActOnStartCategoryImplementation - Perform semantic checks on the
/// category implementation declaration and build an ObjcCategoryImplDecl /// category implementation declaration and build an ObjcCategoryImplDecl
/// object. /// object.
Sema::DeclTy *Sema::ActOnStartCategoryImplementation(Scope* S, Sema::DeclTy *Sema::ActOnStartCategoryImplementation(
SourceLocation AtCatImplLoc, SourceLocation AtCatImplLoc,
IdentifierInfo *ClassName, SourceLocation ClassLoc, IdentifierInfo *ClassName, SourceLocation ClassLoc,
IdentifierInfo *CatName, SourceLocation CatLoc) { IdentifierInfo *CatName, SourceLocation CatLoc) {
@ -1085,7 +1083,7 @@ Sema::DeclTy *Sema::ActOnStartCategoryImplementation(Scope* S,
return CDecl; return CDecl;
} }
Sema::DeclTy *Sema::ActOnStartClassImplementation(Scope *S, Sema::DeclTy *Sema::ActOnStartClassImplementation(
SourceLocation AtClassImplLoc, SourceLocation AtClassImplLoc,
IdentifierInfo *ClassName, SourceLocation ClassLoc, IdentifierInfo *ClassName, SourceLocation ClassLoc,
IdentifierInfo *SuperClassname, IdentifierInfo *SuperClassname,
@ -1093,7 +1091,7 @@ Sema::DeclTy *Sema::ActOnStartClassImplementation(Scope *S,
ObjcInterfaceDecl* IDecl = 0; ObjcInterfaceDecl* IDecl = 0;
// Check for another declaration kind with the same name. // Check for another declaration kind with the same name.
ScopedDecl *PrevDecl = LookupScopedDecl(ClassName, Decl::IDNS_Ordinary, ScopedDecl *PrevDecl = LookupScopedDecl(ClassName, Decl::IDNS_Ordinary,
ClassLoc, S); ClassLoc, TUScope);
if (PrevDecl && !isa<ObjcInterfaceDecl>(PrevDecl)) { if (PrevDecl && !isa<ObjcInterfaceDecl>(PrevDecl)) {
Diag(ClassLoc, diag::err_redefinition_different_kind, Diag(ClassLoc, diag::err_redefinition_different_kind,
ClassName->getName()); ClassName->getName());
@ -1111,7 +1109,7 @@ Sema::DeclTy *Sema::ActOnStartClassImplementation(Scope *S,
if (SuperClassname) { if (SuperClassname) {
// Check if a different kind of symbol declared in this scope. // Check if a different kind of symbol declared in this scope.
PrevDecl = LookupScopedDecl(SuperClassname, Decl::IDNS_Ordinary, PrevDecl = LookupScopedDecl(SuperClassname, Decl::IDNS_Ordinary,
SuperClassLoc, S); SuperClassLoc, TUScope);
if (PrevDecl && !isa<ObjcInterfaceDecl>(PrevDecl)) { if (PrevDecl && !isa<ObjcInterfaceDecl>(PrevDecl)) {
Diag(SuperClassLoc, diag::err_redefinition_different_kind, Diag(SuperClassLoc, diag::err_redefinition_different_kind,
SuperClassname->getName()); SuperClassname->getName());
@ -1317,9 +1315,8 @@ void Sema::ImplCategoryMethodsVsIntfMethods(ObjcCategoryImplDecl *CatImplDecl,
} }
/// ActOnForwardClassDeclaration - /// ActOnForwardClassDeclaration -
/// Scope will always be top level file scope.
Action::DeclTy * Action::DeclTy *
Sema::ActOnForwardClassDeclaration(Scope *S, SourceLocation AtClassLoc, Sema::ActOnForwardClassDeclaration(SourceLocation AtClassLoc,
IdentifierInfo **IdentList, unsigned NumElts) IdentifierInfo **IdentList, unsigned NumElts)
{ {
llvm::SmallVector<ObjcInterfaceDecl*, 32> Interfaces; llvm::SmallVector<ObjcInterfaceDecl*, 32> Interfaces;
@ -1333,7 +1330,7 @@ Sema::ActOnForwardClassDeclaration(Scope *S, SourceLocation AtClassLoc,
IdentList[i]->setFETokenInfo(IDecl); IdentList[i]->setFETokenInfo(IDecl);
// Remember that this needs to be removed when the scope is popped. // Remember that this needs to be removed when the scope is popped.
S->AddDecl(IDecl); TUScope->AddDecl(IDecl);
} }
Interfaces.push_back(IDecl); Interfaces.push_back(IDecl);

View File

@ -445,7 +445,6 @@ public:
// the prologue for a class interface (before parsing the instance // the prologue for a class interface (before parsing the instance
// variables). Instance variables are processed by ActOnFields(). // variables). Instance variables are processed by ActOnFields().
virtual DeclTy *ActOnStartClassInterface( virtual DeclTy *ActOnStartClassInterface(
Scope* S,
SourceLocation AtInterafceLoc, SourceLocation AtInterafceLoc,
IdentifierInfo *ClassName, IdentifierInfo *ClassName,
SourceLocation ClassLoc, SourceLocation ClassLoc,
@ -459,7 +458,6 @@ public:
// ActOnStartProtocolInterface - this action is called immdiately after // ActOnStartProtocolInterface - this action is called immdiately after
// parsing the prologue for a protocol interface. // parsing the prologue for a protocol interface.
virtual DeclTy *ActOnStartProtocolInterface( virtual DeclTy *ActOnStartProtocolInterface(
Scope* S,
SourceLocation AtProtoInterfaceLoc, SourceLocation AtProtoInterfaceLoc,
IdentifierInfo *ProtocolName, IdentifierInfo *ProtocolName,
SourceLocation ProtocolLoc, SourceLocation ProtocolLoc,
@ -470,7 +468,6 @@ public:
// ActOnStartCategoryInterface - this action is called immdiately after // ActOnStartCategoryInterface - this action is called immdiately after
// parsing the prologue for a category interface. // parsing the prologue for a category interface.
virtual DeclTy *ActOnStartCategoryInterface( virtual DeclTy *ActOnStartCategoryInterface(
Scope* S,
SourceLocation AtInterfaceLoc, SourceLocation AtInterfaceLoc,
IdentifierInfo *ClassName, IdentifierInfo *ClassName,
SourceLocation ClassLoc, SourceLocation ClassLoc,
@ -484,7 +481,6 @@ public:
// parsing the prologue for a class implementation. Instance variables are // parsing the prologue for a class implementation. Instance variables are
// processed by ActOnFields(). // processed by ActOnFields().
virtual DeclTy *ActOnStartClassImplementation( virtual DeclTy *ActOnStartClassImplementation(
Scope* S,
SourceLocation AtClassImplLoc, SourceLocation AtClassImplLoc,
IdentifierInfo *ClassName, IdentifierInfo *ClassName,
SourceLocation ClassLoc, SourceLocation ClassLoc,
@ -495,7 +491,6 @@ public:
// ActOnStartCategoryImplementation - this action is called immdiately after // ActOnStartCategoryImplementation - this action is called immdiately after
// parsing the prologue for a category implementation. // parsing the prologue for a category implementation.
virtual DeclTy *ActOnStartCategoryImplementation( virtual DeclTy *ActOnStartCategoryImplementation(
Scope* S,
SourceLocation AtCatImplLoc, SourceLocation AtCatImplLoc,
IdentifierInfo *ClassName, IdentifierInfo *ClassName,
SourceLocation ClassLoc, SourceLocation ClassLoc,
@ -545,14 +540,12 @@ public:
return 0; return 0;
} }
virtual DeclTy *ActOnForwardClassDeclaration( virtual DeclTy *ActOnForwardClassDeclaration(
Scope *S,
SourceLocation AtClassLoc, SourceLocation AtClassLoc,
IdentifierInfo **IdentList, IdentifierInfo **IdentList,
unsigned NumElts) { unsigned NumElts) {
return 0; return 0;
} }
virtual DeclTy *ActOnForwardProtocolDeclaration( virtual DeclTy *ActOnForwardProtocolDeclaration(
Scope *S,
SourceLocation AtProtocolLoc, SourceLocation AtProtocolLoc,
IdentifierInfo **IdentList, IdentifierInfo **IdentList,
unsigned NumElts) { unsigned NumElts) {
@ -562,8 +555,7 @@ public:
/// ActOnFindProtocolDeclaration - This routine looks for a previously /// ActOnFindProtocolDeclaration - This routine looks for a previously
/// declared protocol and returns it. If not found, issues diagnostic. /// declared protocol and returns it. If not found, issues diagnostic.
/// Will build a list of previously protocol declarations found in the list. /// Will build a list of previously protocol declarations found in the list.
virtual DeclTy **ActOnFindProtocolDeclaration(Scope *S, virtual DeclTy **ActOnFindProtocolDeclaration(SourceLocation TypeLoc,
SourceLocation TypeLoc,
IdentifierInfo **ProtocolId, IdentifierInfo **ProtocolId,
unsigned NumProtocols) { unsigned NumProtocols) {
return 0; return 0;
@ -591,6 +583,10 @@ public:
/// the parser doesn't have to build complex data structures and thus runs more /// the parser doesn't have to build complex data structures and thus runs more
/// quickly. /// quickly.
class MinimalAction : public Action { class MinimalAction : public Action {
/// Translation Unit Scope - useful to Objective-C actions that need
/// to lookup file scope declarations in the "ordinary" C decl namespace.
/// For example, user-defined classes, built-in "id" type, etc.
Scope *TUScope;
public: public:
/// isTypeName - This looks at the IdentifierInfo::FETokenInfo field to /// isTypeName - This looks at the IdentifierInfo::FETokenInfo field to
/// determine whether the name is a typedef or not in this scope. /// determine whether the name is a typedef or not in this scope.
@ -604,13 +600,15 @@ public:
/// PopScope - When a scope is popped, if any typedefs are now out-of-scope, /// PopScope - When a scope is popped, if any typedefs are now out-of-scope,
/// they are removed from the IdentifierInfo::FETokenInfo field. /// they are removed from the IdentifierInfo::FETokenInfo field.
virtual void PopScope(SourceLocation Loc, Scope *S); virtual void PopScope(SourceLocation Loc, Scope *S);
virtual void ActOnTranslationUnitScope(SourceLocation Loc, Scope *S) {
TUScope = S;
}
virtual DeclTy *ActOnForwardClassDeclaration(Scope *S, virtual DeclTy *ActOnForwardClassDeclaration(SourceLocation AtClassLoc,
SourceLocation AtClassLoc,
IdentifierInfo **IdentList, IdentifierInfo **IdentList,
unsigned NumElts); unsigned NumElts);
virtual DeclTy *ActOnStartClassInterface(Scope* S, SourceLocation interLoc, virtual DeclTy *ActOnStartClassInterface(SourceLocation interLoc,
IdentifierInfo *ClassName, SourceLocation ClassLoc, IdentifierInfo *ClassName, SourceLocation ClassLoc,
IdentifierInfo *SuperName, SourceLocation SuperLoc, IdentifierInfo *SuperName, SourceLocation SuperLoc,
IdentifierInfo **ProtocolNames, unsigned NumProtocols, IdentifierInfo **ProtocolNames, unsigned NumProtocols,