diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2014-01-03 18:32:18 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2014-01-03 18:32:18 +0000 |
commit | ee82f63db35fa073e6a981c91c3bee58bab0ccc0 (patch) | |
tree | a18b0f42153b35b281decf96d5002d8299ffd87d /lib/Sema/SemaExprObjC.cpp | |
parent | b88a33ac1d3f5acf2e8ace6a7ddc4dc4da36c092 (diff) | |
download | clang-ee82f63db35fa073e6a981c91c3bee58bab0ccc0.tar.gz clang-ee82f63db35fa073e6a981c91c3bee58bab0ccc0.tar.bz2 clang-ee82f63db35fa073e6a981c91c3bee58bab0ccc0.tar.xz |
[objc] Refactor and improve functionality for the -Wunused-property-ivar warning.
- Remove the additions to ObjCMethodDecl & ObjCIVarDecl that were getting de/serialized and consolidate
all functionality for the checking for this warning in Sema::DiagnoseUnusedBackingIvarInAccessor
- Don't check immediately after the method body is finished, check when the @implementation is finished.
This is so we can see if the ivar was referenced by any other method, even if the method was defined after the accessor.
- Don't silence the warning if any method is called from the accessor silence it if the accessor delegates to another method via self.
rdar://15727325
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@198432 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExprObjC.cpp')
-rw-r--r-- | lib/Sema/SemaExprObjC.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp index 48881de3ae..87cff1273a 100644 --- a/lib/Sema/SemaExprObjC.cpp +++ b/lib/Sema/SemaExprObjC.cpp @@ -1380,10 +1380,14 @@ bool Sema::CheckMessageArgumentTypes(QualType ReceiverType, return IsError; } -bool Sema::isSelfExpr(Expr *receiver) { +bool Sema::isSelfExpr(Expr *RExpr) { // 'self' is objc 'self' in an objc method only. - ObjCMethodDecl *method = - dyn_cast_or_null<ObjCMethodDecl>(CurContext->getNonClosureAncestor()); + ObjCMethodDecl *Method = + dyn_cast_or_null<ObjCMethodDecl>(CurContext->getNonClosureAncestor()); + return isSelfExpr(RExpr, Method); +} + +bool Sema::isSelfExpr(Expr *receiver, const ObjCMethodDecl *method) { if (!method) return false; receiver = receiver->IgnoreParenLValueCasts(); @@ -2643,8 +2647,6 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver, } } } - if (ObjCMethodDecl *CurMeth = getCurMethodDecl()) - CurMeth->setMethodCallsMethod(true); return MaybeBindToTemporary(Result); } |