diff options
| author | Fariborz Jahanian <fjahanian@apple.com> | 2010-12-03 23:37:08 +0000 |
|---|---|---|
| committer | Fariborz Jahanian <fjahanian@apple.com> | 2010-12-03 23:37:08 +0000 |
| commit | ecbbb6e9bae188e9026ec3b41554dde054c79f7b (patch) | |
| tree | 3472abeb2e5cb695e3e8498a9354a8fc826cb490 /clang/lib/Sema | |
| parent | f8af778e1f8e83522cd6c3c7cb85ea97e4de5db1 (diff) | |
| download | bcm5719-llvm-ecbbb6e9bae188e9026ec3b41554dde054c79f7b.tar.gz bcm5719-llvm-ecbbb6e9bae188e9026ec3b41554dde054c79f7b.zip | |
Diagnose when accessing property in a class method and
no property accessor class method to be found, instead of
crashing in IRGen. // rdar://8703553
llvm-svn: 120855
Diffstat (limited to 'clang/lib/Sema')
| -rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 5 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaExprObjC.cpp | 4 |
2 files changed, 5 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 9102cac8791..270aa3e06b4 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -3498,12 +3498,13 @@ Sema::LookupMemberExpr(LookupResult &R, Expr *&BaseExpr, if (ObjCMethodDecl *MD = getCurMethodDecl()) { ObjCInterfaceDecl *IFace = MD->getClassInterface(); ObjCMethodDecl *Getter; - // FIXME: need to also look locally in the implementation. if ((Getter = IFace->lookupClassMethod(Sel))) { // Check the use of this method. if (DiagnoseUseOfDecl(Getter, MemberLoc)) return ExprError(); } + else + Getter = IFace->lookupPrivateMethod(Sel, false); // If we found a getter then this may be a valid dot-reference, we // will look for the matching setter, in case it is needed. Selector SetterSel = @@ -3513,7 +3514,7 @@ Sema::LookupMemberExpr(LookupResult &R, Expr *&BaseExpr, if (!Setter) { // If this reference is in an @implementation, also check for 'private' // methods. - Setter = IFace->lookupPrivateInstanceMethod(SetterSel); + Setter = IFace->lookupPrivateMethod(SetterSel, false); } // Look through local category implementations associated with the class. if (!Setter) diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp index 46a834a4874..e60aa071e2d 100644 --- a/clang/lib/Sema/SemaExprObjC.cpp +++ b/clang/lib/Sema/SemaExprObjC.cpp @@ -402,7 +402,7 @@ HandleExprPropertyRefExpr(const ObjCObjectPointerType *OPT, // If this reference is in an @implementation, check for 'private' methods. if (!Getter) - Getter = IFace->lookupPrivateInstanceMethod(Sel); + Getter = IFace->lookupPrivateMethod(Sel); // Look through local category implementations associated with the class. if (!Getter) @@ -421,7 +421,7 @@ HandleExprPropertyRefExpr(const ObjCObjectPointerType *OPT, if (!Setter) { // If this reference is in an @implementation, also check for 'private' // methods. - Setter = IFace->lookupPrivateInstanceMethod(SetterSel); + Setter = IFace->lookupPrivateMethod(SetterSel); } // Look through local category implementations associated with the class. if (!Setter) |

