From: Fariborz Jahanian Date: Tue, 30 Oct 2007 18:27:03 +0000 (+0000) Subject: Revisited my last patch to be able to do encoding of ivar types with 'id'. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bb60846268636b994caa609db2352d6142b4780a;p=clang Revisited my last patch to be able to do encoding of ivar types with 'id'. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43507 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/Sema/SemaDecl.cpp b/Sema/SemaDecl.cpp index f4717ce66b..c23ed69b1b 100644 --- a/Sema/SemaDecl.cpp +++ b/Sema/SemaDecl.cpp @@ -1193,6 +1193,15 @@ Sema::DeclTy *Sema::ActOnStartCategoryImplementation( /// Check that class of this category is already completely declared. if (!IDecl || IDecl->isForwardDecl()) Diag(ClassLoc, diag::err_undef_interface, ClassName->getName()); + + // We cannot build type 'id' laziliy. It is needed when checking if a + // type is an 'id' (via call to isObjcIdType) even if there is no + // need for the dafult 'id' type. + // FIXME: Depending on the need to compare to 'id', this may have to go + // somewhere else. At this time, this is a good enough place to do type + // encoding of methods and ivars for the rewrite client. + GetObjcIdType(AtCatImplLoc); + /// TODO: Check that CatName, category name, is not used in another // implementation. return CDecl; @@ -1261,7 +1270,15 @@ Sema::DeclTy *Sema::ActOnStartClassImplementation( // Check that there is no duplicate implementation of this class. if (!ObjcImplementations.insert(ClassName)) Diag(ClassLoc, diag::err_dup_implementation_class, ClassName->getName()); - + + // We cannot build type 'id' laziliy. It is needed when checking if a + // type is an 'id' (via call to isObjcIdType) even if there is no + // need for the dafult 'id' type. + // FIXME: Depending on the need to compare to 'id', this may have to go + // somewhere else. At this time, this is a good enough place to do type + // encoding of methods and ivars for the rewrite client. + GetObjcIdType(AtClassImplLoc); + return IMPDecl; } @@ -1964,14 +1981,6 @@ Sema::DeclTy *Sema::ActOnMethodDeclaration( AttributeList *AttrList, tok::ObjCKeywordKind MethodDeclKind) { llvm::SmallVector Params; - // We cannot build type 'id' laziliy. It is needed when checking if a - // type is an 'id' (via call to isObjcIdType) even if there is no - // need for the dafult 'id' type. - // FIXME: Depending on the need to compare to 'id', this may have to go - // somewhere else. At this time, this is a good enough place to do type - // encoding of methods and ivars for the rewrite client. - GetObjcIdType(MethodLoc); - for (unsigned i = 0; i < Sel.getNumArgs(); i++) { // FIXME: arg->AttrList must be stored too! QualType argType; diff --git a/test/Sema/ivar-encoding-1.m b/test/Sema/ivar-encoding-1.m new file mode 100644 index 0000000000..1f7812fadf --- /dev/null +++ b/test/Sema/ivar-encoding-1.m @@ -0,0 +1,15 @@ +// RUN: clang -rewrite-test -verify %s + +@interface Intf +{ + id ivar; + id ivar1[12]; + + id **ivar3; + + id (*ivar4) (id, id); +} +@end + +@implementation Intf +@end