This is an archive of the discontinued LLVM Phabricator instance.

[Analyzer] ConversionChecker: track back the cast expression
ClosedPublic

Authored by martong on Sep 15 2021, 9:35 AM.

Details

Summary

Adding trackExpressionValue to the checker so it tracks the value of the
implicit cast's DeclRefExpression up to initialization/assignment. This
way the report becomes cleaner.

Diff Detail

Event Timeline

martong created this revision.Sep 15 2021, 9:35 AM
martong requested review of this revision.Sep 15 2021, 9:35 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 15 2021, 9:35 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
steakhal accepted this revision.Sep 15 2021, 3:30 PM

LGTM.
Thanks for fixing this.

Should this checker remain in alpha in its current form?
WDYT? @all

This revision is now accepted and ready to land.Sep 15 2021, 3:30 PM

LGTM.
Thanks for fixing this.

Thanks for the review!

Should this checker remain in alpha in its current form?
WDYT? @all

There is no clear explanation for this checker being alpha. TLDR; I think this could be moved out of alpha now. @NoQ ?

The checker was accepted in this patch https://reviews.llvm.org/D13126 . Here, Artem vaguely explains he would "probably move out of alpha whenever it's tweaked to somehow make sure it finds enough real bugs among intentional integer truncations, which would most likely require some nontrivial heuristics". Daniel (the author) claims that he found roughly 10-15% false positives: "I have looked all warnings that I got. 1678 projects where scanned. In total I got 124 warnings. I classified 91 warnings as TP. 14 as FP. and then there were 19 that I failed to triage."

Since then, the author created a patch that targets some of the FPs: https://reviews.llvm.org/D25596
With this patch, the bugreports are cleaner. Also, in our bugreport database, I could not found any obvious false positives for the checker.