diff options
author | Steve Naroff <snaroff@apple.com> | 2008-09-29 14:20:56 +0000 |
---|---|---|
committer | Steve Naroff <snaroff@apple.com> | 2008-09-29 14:20:56 +0000 |
commit | 5e0a74fbf478da0dfe746b9d9c917cff37ae5175 (patch) | |
tree | de6c10cf83cbea9794857bb745c7456224973f64 /lib/Sema/SemaDeclObjC.cpp | |
parent | 48002c89578eaeb008a0bb5a10d8216e61906459 (diff) |
Fix <rdar://problem/6253149> property declaration doesn't declare getter and setter.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56785 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclObjC.cpp')
-rw-r--r-- | lib/Sema/SemaDeclObjC.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index 0241655026..4e05a137a5 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -874,6 +874,9 @@ void Sema::ActOnAtEnd(SourceLocation AtEndLoc, DeclTy *classDecl, } } } + // Save the size so we can detect if we've added any property methods. + unsigned int insMethodsSizePriorToPropAdds = insMethods.size(); + unsigned int clsMethodsSizePriorToPropAdds = clsMethods.size(); if (ObjCInterfaceDecl *I = dyn_cast<ObjCInterfaceDecl>(ClassDecl)) { // Compares properties declared in this class to those of its @@ -925,6 +928,24 @@ void Sema::ActOnAtEnd(SourceLocation AtEndLoc, DeclTy *classDecl, } } } + // Add any synthesized methods to the global pool. This allows us to + // handle the following, which is supported by GCC (and part of the design). + // + // @interface Foo + // @property double bar; + // @end + // + // void thisIsUnfortunate() { + // id foo; + // double bar = [foo bar]; + // } + // + if (insMethodsSizePriorToPropAdds < insMethods.size()) + for (unsigned i = insMethodsSizePriorToPropAdds; i < insMethods.size(); i++) + AddInstanceMethodToGlobalPool(insMethods[i]); + if (clsMethodsSizePriorToPropAdds < clsMethods.size()) + for (unsigned i = clsMethodsSizePriorToPropAdds; i < clsMethods.size(); i++) + AddFactoryMethodToGlobalPool(clsMethods[i]); } |