Page MenuHomePhabricator

[analyzer][UninitializedObjectChecker] New flag to ignore records based on it's fields

Authored by Szelethus on Sep 5 2018, 4:47 AM.



Based on a suggestion from @george.karpenkov.

In some cases, structs are used as unions with a help of a tag/kind field. This patch adds a new string flag (a pattern), that is matched against the fields of a record, and should a match be found, the entire record is ignored.

For more info refer to and to the responses to that, especially

Diff Detail


Event Timeline

Szelethus created this revision.Sep 5 2018, 4:47 AM
Szelethus updated this revision to Diff 164050.Sep 5 2018, 8:38 AM

Added doc to www/analyzer/alpha_checks.html.

468 ↗(On Diff #164050)
  1. Since you are using match, you would reject an extra prefix - but what about an extra suffix?
  2. Would it make sense to expose the entire regexp as a flag? Then you could remove the boolean flag (if you can change the regexp to match if only the entire field name matches, then an empty regexp would correspond to "no matches")
Szelethus retitled this revision from [analyzer][UninitializedObjectChecker] New flag to ignore union-like constructs to [analyzer][UninitializedObjectChecker] New flag to ignore records based on it's fields.
Szelethus edited the summary of this revision. (Show Details)

Generalized the patch so that the user can supply the pattern that is matched against the fields of the records.

Szelethus marked an inline comment as done.Sep 10 2018, 10:31 AM
Szelethus added inline comments.
468 ↗(On Diff #164050)
  1. Added a new test case, seems to be fine ^-^
  2. Sounds cool, so I made it happen.
NoQ accepted this revision.Sep 13 2018, 7:15 PM

I hope we'll be able to come up with a reasonable default regex.

1–4 ↗(On Diff #164696)

If you like, you can make a directory for your tests, instead of a filename prefix.

Btw, thanks for pointing out that we can use \ in run-lines, i never noticed it before you started using it.

This revision is now accepted and ready to land.Sep 13 2018, 7:15 PM
Szelethus marked an inline comment as done.Sep 14 2018, 3:07 AM
Szelethus added inline comments.
1–4 ↗(On Diff #164696)

Cheers! I actually saw this trick in D45050.

This revision was automatically updated to reflect the committed changes.