diff options
| author | Ted Kremenek <kremenek@apple.com> | 2010-09-21 20:52:59 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2010-09-21 20:52:59 +0000 |
| commit | 2f07563f47d95170d442072bf81c36bf7cd6a1d7 (patch) | |
| tree | 73e63a74137c4ffff5f5c872009f34cb09f7a89e /clang/lib/Sema/SemaObjCProperty.cpp | |
| parent | c8effb80cb4e9c82f5bda4032fbd1710dc2b3864 (diff) | |
| download | bcm5719-llvm-2f07563f47d95170d442072bf81c36bf7cd6a1d7.tar.gz bcm5719-llvm-2f07563f47d95170d442072bf81c36bf7cd6a1d7.zip | |
Correctly register the class extension as the lexical DeclContext for ObjC methods declared with @property in class extensions.
This matches the behavior for setters.
Also pass the class extension to ProcessPropertyDecl as the lexical DeclContext, even when not redeclaring the @property.
This fixes the remaining issues in <rdar://problem/7410145>.
llvm-svn: 114477
Diffstat (limited to 'clang/lib/Sema/SemaObjCProperty.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaObjCProperty.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/clang/lib/Sema/SemaObjCProperty.cpp b/clang/lib/Sema/SemaObjCProperty.cpp index a6f251e107f..ba71b4ca4df 100644 --- a/clang/lib/Sema/SemaObjCProperty.cpp +++ b/clang/lib/Sema/SemaObjCProperty.cpp @@ -137,9 +137,9 @@ Sema::HandlePropertyInClassExtension(Scope *S, ObjCCategoryDecl *CDecl, // A case of continuation class adding a new property in the class. This // is not what it was meant for. However, gcc supports it and so should we. // Make sure setter/getters are declared here. - ProcessPropertyDecl(PDecl, CCPrimary); + ProcessPropertyDecl(PDecl, CCPrimary, /* redeclaredProperty = */ 0, + /* lexicalDC = */ CDecl); return PDecl; - } // The property 'PIDecl's readonly attribute will be over-ridden @@ -1099,8 +1099,12 @@ void Sema::ProcessPropertyDecl(ObjCPropertyDecl *property, // No instance method of same name as property getter name was found. // Declare a getter method and add it to the list of methods // for this class. - GetterMethod = ObjCMethodDecl::Create(Context, property->getLocation(), - property->getLocation(), property->getGetterName(), + SourceLocation Loc = redeclaredProperty ? + redeclaredProperty->getLocation() : + property->getLocation(); + + GetterMethod = ObjCMethodDecl::Create(Context, Loc, Loc, + property->getGetterName(), property->getType(), 0, CD, true, false, true, false, (property->getPropertyImplementation() == @@ -1110,9 +1114,8 @@ void Sema::ProcessPropertyDecl(ObjCPropertyDecl *property, CD->addDecl(GetterMethod); // FIXME: Eventually this shouldn't be needed, as the lexical context // and the real context should be the same. - if (DeclContext *lexicalDC = property->getLexicalDeclContext()) + if (lexicalDC) GetterMethod->setLexicalDeclContext(lexicalDC); - } else // A user declared getter will be synthesize when @synthesize of // the property with the same name is seen in the @implementation |

