[PATCH] D43791: [analyzer] Suppress MallocChecker positives in destructors with atomics.

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 26 18:41:06 PST 2018


NoQ added inline comments.


================
Comment at: lib/StaticAnalyzer/Checkers/MallocChecker.cpp:2899
+      // to find out if a likely-false-positive suppression should kick in.
+      for (const LocationContext *LC = CurrentLC; LC; LC = LC->getParent()) {
+        if (isa<CXXDestructorDecl>(LC->getDecl())) {
----------------
george.karpenkov wrote:
> NoQ wrote:
> > george.karpenkov wrote:
> > > I'm not sure what is going on here.
> > > We are just traversing the stack frame, finding the first destructor in the `isReleased` branch?
> > Do the updated comments make it more clear?
> I'm still confused :( you're going up the chain of frames until you see a destructor. How do you know that memory was released in a destructor at all, or that it was released in this particular destructor?
`if (isReleased(RS, RSPrev, S))` says that the pointer against which the report is thrown was released in the current node.


https://reviews.llvm.org/D43791





More information about the cfe-commits mailing list