This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] Speedup misc-static-assert.
ClosedPublic

Authored by sbenza on May 3 2016, 11:11 AM.

Details

Summary

Speedup the misc-static-assert check by not use stmt() as the toplevel matcher.
The framework runs a filter on the matchers before trying them on each node and
uses the toplevel type for this.
Using stmt() as the toplevel causes the matcher to be run on every Stmt node,
even if the node doesn't match the desired types.

This change speeds up clang-tidy by ~5% in a benchmark.

Diff Detail

Repository
rL LLVM

Event Timeline

sbenza updated this revision to Diff 56028.May 3 2016, 11:11 AM
sbenza retitled this revision from to [clang-tidy] Speedup misc-static-assert..
sbenza updated this object.
sbenza added a reviewer: alexfh.
sbenza added a subscriber: cfe-commits.
aaron.ballman accepted this revision.May 3 2016, 11:14 AM
aaron.ballman added a reviewer: aaron.ballman.
aaron.ballman added a subscriber: aaron.ballman.

LGTM, thank you for noticing that!

This revision is now accepted and ready to land.May 3 2016, 11:14 AM
This revision was automatically updated to reflect the committed changes.
alexfh edited edge metadata.May 4 2016, 4:38 AM

Thank you for finding and fixing this! I think I used to suggest the wrong pattern, now I won't.