<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Apr 10, 2013, at 14:42 , Anna Zaks <<a href="mailto:ganna@apple.com">ganna@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Author: zaks<br>Date: Wed Apr 10 16:42:02 2013<br>New Revision: 179219<br><br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project?rev=179219&view=rev">http://llvm.org/viewvc/llvm-project?rev=179219&view=rev</a><br>Log:<br>[analyzer] Cleanup leak warnings: do not print the names of variables from other functions.<br><br>Modified:<br>   cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp<br>   cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp<br>   cfe/trunk/test/Analysis/malloc-plist.c<br>   cfe/trunk/test/Analysis/retain-release.m<br><br>Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp?rev=179219&r1=179218&r2=179219&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp?rev=179219&r1=179218&r2=179219&view=diff</a><br>==============================================================================<br>--- cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp (original)<br>+++ cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp Wed Apr 10 16:42:02 2013<br>@@ -1527,13 +1527,19 @@ MallocChecker::getAllocationSite(const E<br><br>    // Find the most recent expression bound to the symbol in the current<br>    // context.<br>-    if (!ReferenceRegion) {<br>-      if (const MemRegion *MR = C.getLocationRegionIfPostStore(N)) {<br>-        SVal Val = State->getSVal(MR);<br>-        if (Val.getAsLocSymbol() == Sym)<br>-          ReferenceRegion = MR;<br>+      if (!ReferenceRegion) {<br>+        if (const MemRegion *MR = C.getLocationRegionIfPostStore(N)) {<br>+          SVal Val = State->getSVal(MR);<br>+          if (Val.getAsLocSymbol() == Sym) {<br>+            const VarRegion* VR = MR->getAs<VarRegion>();<br>+            // Do not show local variables belonging to a function other than<br>+            // where the error is reported.<br>+            if (!VR ||<br>+                (VR->getStackFrame() == LeakContext->getCurrentStackFrame()))<br>+              ReferenceRegion = MR;<br></div></blockquote><div><br></div><div>This probably isn't good enough; consider storing into a field of a local variable in the wrong stack frame. Maybe use MR->getBaseRegion()?</div><div><br></div></div></body></html>