summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2007-10-02 21:43:37 +0000
committerSteve Naroff <snaroff@apple.com>2007-10-02 21:43:37 +0000
commitd1741552040fc6cef96acc96c11f06c6ff3a8734 (patch)
tree1dc51f04293685932bc9bfb6370c89de3de9e2c4
parentf214ff87014f953269d099b1798a4a662d58dc32 (diff)
downloadbcm5719-llvm-d1741552040fc6cef96acc96c11f06c6ff3a8734.tar.gz
bcm5719-llvm-d1741552040fc6cef96acc96c11f06c6ff3a8734.zip
Remove Action::ActOnImpleIvarVsClassIvars(), it is only called by Sema (not Parser).
Add Sema::CheckImplementationIvars() to replace the previous action. llvm-svn: 42553
-rw-r--r--clang/Sema/Sema.h9
-rw-r--r--clang/Sema/SemaDecl.cpp24
-rw-r--r--clang/include/clang/AST/DeclObjC.h3
-rw-r--r--clang/include/clang/Parse/Action.h4
4 files changed, 19 insertions, 21 deletions
diff --git a/clang/Sema/Sema.h b/clang/Sema/Sema.h
index b1906d3a249..e9dc4d0cb2c 100644
--- a/clang/Sema/Sema.h
+++ b/clang/Sema/Sema.h
@@ -51,6 +51,7 @@ namespace clang {
class ObjcImplementationDecl;
class ObjcCategoryImplDecl;
class ObjcCategoryDecl;
+ class ObjcIvarDecl;
/// Sema - This implements semantic analysis and AST building for C.
class Sema : public Action {
@@ -216,6 +217,11 @@ private:
const llvm::DenseMap<void *, char>& InsMap,
const llvm::DenseMap<void *, char>& ClsMap);
+ /// CheckImplementationIvars - This routine checks if the instance variables
+ /// listed in the implelementation match those listed in the interface.
+ void CheckImplementationIvars(ObjcImplementationDecl *ImpDecl,
+ ObjcIvarDecl **Fields, unsigned nIvars);
+
/// ImplMethodsVsClassMethods - This is main routine to warn if any method
/// remains unimplemented in the @implementation class.
void ImplMethodsVsClassMethods(ObjcImplementationDecl* IMPDecl,
@@ -421,9 +427,6 @@ public:
virtual void ObjcAddMethodsToClass(Scope* S, DeclTy *ClassDecl,
DeclTy **allMethods, unsigned allNum);
- virtual void ActOnImpleIvarVsClassIvars(DeclTy *ClassDecl,
- DeclTy **Fields, unsigned NumFields);
-
virtual DeclTy *ObjcBuildMethodDeclaration(SourceLocation MethodLoc,
tok::TokenKind MethodType, TypeTy *ReturnType, Selector Sel,
// optional arguments. The number of types/arguments is obtained
diff --git a/clang/Sema/SemaDecl.cpp b/clang/Sema/SemaDecl.cpp
index 64789bc3f50..1e0198aa853 100644
--- a/clang/Sema/SemaDecl.cpp
+++ b/clang/Sema/SemaDecl.cpp
@@ -1168,17 +1168,18 @@ Sema::DeclTy *Sema::ObjcStartClassImplementation(Scope *S,
return IMPDecl;
}
-void Sema::ActOnImpleIvarVsClassIvars(DeclTy *ClassDecl,
- DeclTy **Fields, unsigned numIvars) {
- ObjcInterfaceDecl* IDecl =
- cast<ObjcInterfaceDecl>(static_cast<Decl*>(ClassDecl));
- assert(IDecl && "missing named interface class decl");
- ObjcIvarDecl** ivars = reinterpret_cast<ObjcIvarDecl**>(Fields);
+void Sema::CheckImplementationIvars(ObjcImplementationDecl *ImpDecl,
+ ObjcIvarDecl **ivars, unsigned numIvars) {
+ assert(ImpDecl && "missing implementation decl");
+ ObjcInterfaceDecl* IDecl = getObjCInterfaceDecl(ImpDecl->getIdentifier());
+
+ if (!IDecl)
+ return;
assert(ivars && "missing @implementation ivars");
- // Check interface's Ivar list against those in the implementation.
- // names and types must match.
- //
+ // Check interface's Ivar list against those in the implementation.
+ // names and types must match.
+ //
ObjcIvarDecl** IntfIvars = IDecl->getIntfDeclIvars();
int IntfNumIvars = IDecl->getIntfDeclNumIvars();
unsigned j = 0;
@@ -1676,10 +1677,7 @@ void Sema::ActOnFields(Scope* S,
cast<ObjcImplementationDecl>(static_cast<Decl*>(RecDecl));
assert(IMPDecl && "ActOnFields - missing ObjcImplementationDecl");
IMPDecl->ObjcAddInstanceVariablesToClassImpl(ClsFields, RecFields.size());
- ObjcInterfaceDecl* IDecl = getObjCInterfaceDecl(IMPDecl->getIdentifier());
- if (IDecl)
- ActOnImpleIvarVsClassIvars(static_cast<DeclTy*>(IDecl),
- reinterpret_cast<DeclTy**>(&RecFields[0]), RecFields.size());
+ CheckImplementationIvars(IMPDecl, ClsFields, RecFields.size());
}
}
}
diff --git a/clang/include/clang/AST/DeclObjC.h b/clang/include/clang/AST/DeclObjC.h
index 4509be09535..b0ff5feb9d6 100644
--- a/clang/include/clang/AST/DeclObjC.h
+++ b/clang/include/clang/AST/DeclObjC.h
@@ -81,7 +81,8 @@ public:
ListCategories(0), ForwardDecl(FD) {
AllocIntfRefProtocols(numRefProtos);
}
-
+
+ // This is necessary when converting a forward declaration to a definition.
void AllocIntfRefProtocols(unsigned numRefProtos) {
if (numRefProtos) {
IntfRefProtocols = new ObjcProtocolDecl*[numRefProtos];
diff --git a/clang/include/clang/Parse/Action.h b/clang/include/clang/Parse/Action.h
index 0376860160b..73580badd8c 100644
--- a/clang/include/clang/Parse/Action.h
+++ b/clang/include/clang/Parse/Action.h
@@ -448,10 +448,6 @@ public:
DeclTy **allMethods, unsigned allNum) {
return;
}
- virtual void ActOnImpleIvarVsClassIvars(DeclTy *ClassDecl,
- DeclTy **Fields, unsigned NumFields) {
- return;
- }
virtual DeclTy *ObjcStartProtoInterface(Scope* S,
SourceLocation AtProtoInterfaceLoc,
IdentifierInfo *ProtocolName, SourceLocation ProtocolLoc,
OpenPOWER on IntegriCloud