diff options
author | Jordan Rose <jordan_rose@apple.com> | 2015-03-07 05:47:24 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2015-03-07 05:47:24 +0000 |
commit | 58f8cc15c96c35789c4b50f182808a34b0ce4eb5 (patch) | |
tree | cd305a584d6957beb04c3c6772d35054a2706d48 /clang/lib/StaticAnalyzer | |
parent | 9b21ded6c8a615b8a5e9f822d40f632795675633 (diff) | |
download | bcm5719-llvm-58f8cc15c96c35789c4b50f182808a34b0ce4eb5.tar.gz bcm5719-llvm-58f8cc15c96c35789c4b50f182808a34b0ce4eb5.zip |
[analyzer] RetainCountChecker: CF properties are always manually retain-counted.
In theory we could assume a CF property is stored at +0 if there's not a custom
setter, but that's not really worth the complexity. What we do know is that a
CF property can't have ownership attributes, and so we shouldn't assume anything
about the ownership of the ivar.
rdar://problem/20076963
llvm-svn: 231553
Diffstat (limited to 'clang/lib/StaticAnalyzer')
-rw-r--r-- | clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp index 55c7a65e6a6..1991d2bad1b 100644 --- a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp @@ -2882,9 +2882,10 @@ void RetainCountChecker::checkPostStmt(const ObjCIvarRefExpr *IRE, // Also don't do anything if the ivar is unretained. If so, we know that // there's no outstanding retain count for the value. - if (const ObjCPropertyDecl *Prop = findPropForIvar(IRE->getDecl())) - if (!Prop->isRetaining()) - return; + if (Kind == RetEffect::ObjC) + if (const ObjCPropertyDecl *Prop = findPropForIvar(IRE->getDecl())) + if (!Prop->isRetaining()) + return; // Note that this value has been loaded from an ivar. C.addTransition(setRefBinding(State, Sym, RV->withIvarAccess())); @@ -2900,12 +2901,16 @@ void RetainCountChecker::checkPostStmt(const ObjCIvarRefExpr *IRE, } // Try to find the property associated with this ivar. - const ObjCPropertyDecl *Prop = findPropForIvar(IRE->getDecl()); - - if (Prop && !Prop->isRetaining()) - State = setRefBinding(State, Sym, PlusZero); - else + if (Kind != RetEffect::ObjC) { State = setRefBinding(State, Sym, PlusZero.withIvarAccess()); + } else { + const ObjCPropertyDecl *Prop = findPropForIvar(IRE->getDecl()); + + if (Prop && !Prop->isRetaining()) + State = setRefBinding(State, Sym, PlusZero); + else + State = setRefBinding(State, Sym, PlusZero.withIvarAccess()); + } C.addTransition(State); } |