Addressed in r179235. On Apr 10, 2013, at 2:50 PM, Jordan Rose <[email protected]> wrote:
> > On Apr 10, 2013, at 14:42 , Anna Zaks <[email protected]> wrote: > >> Author: zaks >> Date: Wed Apr 10 16:42:02 2013 >> New Revision: 179219 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=179219&view=rev >> Log: >> [analyzer] Cleanup leak warnings: do not print the names of variables from >> other functions. >> >> Modified: >> cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp >> cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp >> cfe/trunk/test/Analysis/malloc-plist.c >> cfe/trunk/test/Analysis/retain-release.m >> >> Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp?rev=179219&r1=179218&r2=179219&view=diff >> ============================================================================== >> --- cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp (original) >> +++ cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp Wed Apr 10 >> 16:42:02 2013 >> @@ -1527,13 +1527,19 @@ MallocChecker::getAllocationSite(const E >> >> // Find the most recent expression bound to the symbol in the current >> // context. >> - if (!ReferenceRegion) { >> - if (const MemRegion *MR = C.getLocationRegionIfPostStore(N)) { >> - SVal Val = State->getSVal(MR); >> - if (Val.getAsLocSymbol() == Sym) >> - ReferenceRegion = MR; >> + if (!ReferenceRegion) { >> + if (const MemRegion *MR = C.getLocationRegionIfPostStore(N)) { >> + SVal Val = State->getSVal(MR); >> + if (Val.getAsLocSymbol() == Sym) { >> + const VarRegion* VR = MR->getAs<VarRegion>(); >> + // Do not show local variables belonging to a function other >> than >> + // where the error is reported. >> + if (!VR || >> + (VR->getStackFrame() == >> LeakContext->getCurrentStackFrame())) >> + ReferenceRegion = MR; > > This probably isn't good enough; consider storing into a field of a local > variable in the wrong stack frame. Maybe use MR->getBaseRegion()?
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
