This is an archive of the discontinued LLVM Phabricator instance.

[analyzer] Suppress a leak false positive in Qt's QObject::connectImpl()
ClosedPublic

Authored by NoQ on Dec 13 2016, 9:22 AM.

Details

Summary

A quick fix to address the false positive posted by Tiago Macarios in the mailing lists: http://lists.llvm.org/pipermail/cfe-dev/2016-December/051738.html

MallocChecker processes pointer escapes heuristically rather than regularly. Force it to treat the pointers passed to connectImpl() as escaping.

I dislike a few things about this patch - we're patching against implementation details and hardcoding names of private methods in an external library. I don't see a significantly better solution within the current approach though.

See also D27599 - a similar hack for another function.

Diff Detail

Repository
rL LLVM

Event Timeline

NoQ updated this revision to Diff 81239.Dec 13 2016, 9:22 AM
NoQ retitled this revision from to [analyzer] Suppress a leak false positive in Qt's QObject::connectImpl().
NoQ updated this object.
NoQ added a subscriber: cfe-commits.
a.sidorin accepted this revision.Dec 13 2016, 9:39 AM
a.sidorin edited edge metadata.

LGTM, thanks!

lib/StaticAnalyzer/Checkers/MallocChecker.cpp
2577 ↗(On Diff #81239)

Sorry for disturbing you for code which is not yours but this line looks exactly like the line upper and seems to be a dead/useless code.

This revision is now accepted and ready to land.Dec 13 2016, 9:39 AM
zaks.anna accepted this revision.Dec 14 2016, 9:57 AM
zaks.anna edited edge metadata.
This revision was automatically updated to reflect the committed changes.