[PATCH] D55528: [analyzer] Resolve another bug where the name of the leaked object was not printed properly
George Karpenkov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 10 17:16:26 PST 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rC348819: [analyzer] Resolve another bug where the name of the leaked object was not… (authored by george.karpenkov, committed by ).
Herald added a subscriber: cfe-commits.
Changed prior to commit:
https://reviews.llvm.org/D55528?vs=177601&id=177631#toc
Repository:
rC Clang
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D55528/new/
https://reviews.llvm.org/D55528
Files:
lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp
test/Analysis/osobject-retain-release.cpp
Index: lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp
===================================================================
--- lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp
+++ lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp
@@ -405,11 +405,11 @@
if (FB) {
const MemRegion *R = FB.getRegion();
- const VarRegion *VR = R->getBaseRegion()->getAs<VarRegion>();
// Do not show local variables belonging to a function other than
// where the error is reported.
- if (!VR || VR->getStackFrame() == LeakContext->getStackFrame())
- FirstBinding = R;
+ if (auto MR = dyn_cast<StackSpaceRegion>(R->getMemorySpace()))
+ if (MR->getStackFrame() == LeakContext->getStackFrame())
+ FirstBinding = R;
}
// AllocationNode is the last node in which the symbol was tracked.
Index: test/Analysis/osobject-retain-release.cpp
===================================================================
--- test/Analysis/osobject-retain-release.cpp
+++ test/Analysis/osobject-retain-release.cpp
@@ -153,8 +153,8 @@
unsigned int check_leak_explicit_new() {
OSArray *arr = new OSArray; // expected-note{{Operator new returns an OSObject of type OSArray with a +1 retain count}}
- return arr->getCount(); // expected-note{{Object leaked: allocated object of type OSArray is not referenced later in this execution path and has a retain count of +1}}
- // expected-warning at -1{{Potential leak of an object of type OSArray}}
+ return arr->getCount(); // expected-note{{Object leaked: object allocated and stored into 'arr' is not referenced later in this execution path and has a retain count of +1}}
+ // expected-warning at -1{{Potential leak of an object stored into 'arr'}}
}
unsigned int check_leak_factory() {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55528.177631.patch
Type: text/x-patch
Size: 1896 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181211/fbd14aca/attachment.bin>
More information about the cfe-commits
mailing list