diff options
author | Ted Kremenek <kremenek@apple.com> | 2014-01-15 00:59:23 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2014-01-15 00:59:23 +0000 |
commit | 0f83390540211e3a456d6b16b918c436cafdd654 (patch) | |
tree | 8fe74106837021525f92012116c981e57d21901e /clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp | |
parent | 1ad8457570e8641f9729b8cd45d2468bea59a754 (diff) | |
download | bcm5719-llvm-0f83390540211e3a456d6b16b918c436cafdd654.tar.gz bcm5719-llvm-0f83390540211e3a456d6b16b918c436cafdd654.zip |
Teach DeadStoresChecker about attribute objc_precise_lifetime.
llvm-svn: 199277
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp index 3468140c917..4ad4e1c8c62 100644 --- a/clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp @@ -214,7 +214,8 @@ public: return; if (!isLive(Live, VD) && - !(VD->hasAttr<UnusedAttr>() || VD->hasAttr<BlocksAttr>())) { + !(VD->hasAttr<UnusedAttr>() || VD->hasAttr<BlocksAttr>() || + VD->hasAttr<ObjCPreciseLifetimeAttr>())) { PathDiagnosticLocation ExLoc = PathDiagnosticLocation::createBegin(Ex, BR.getSourceManager(), AC); @@ -339,8 +340,10 @@ public: // A dead initialization is a variable that is dead after it // is initialized. We don't flag warnings for those variables - // marked 'unused'. - if (!isLive(Live, V) && !V->hasAttr<UnusedAttr>()) { + // marked 'unused' or 'objc_precise_lifetime'. + if (!isLive(Live, V) && + !V->hasAttr<UnusedAttr>() && + !V->hasAttr<ObjCPreciseLifetimeAttr>()) { // Special case: check for initializations with constants. // // e.g. : int x = 0; |