This is an archive of the discontinued LLVM Phabricator instance.

[ASTMatchers][NFC] Use move semantics when passing matchers around.
ClosedPublic

Authored by njames93 on Mar 17 2021, 10:01 AM.

Details

Summary

Changing matchers to use non-const members and adding r-value overloads of matcher conversions enables move optimisations.
I don't have performance figures but I can say this knocked 120k from the clang-tidy binary(86k was from the .text section) on a Release with assertions build(x86_64-unknown-linux-gnu).

Diff Detail

Event Timeline

njames93 created this revision.Mar 17 2021, 10:01 AM
njames93 requested review of this revision.Mar 17 2021, 10:01 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 17 2021, 10:01 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
njames93 updated this revision to Diff 331340.Mar 17 2021, 12:13 PM

Fix PP guards erroneously using #ifdef

aaron.ballman accepted this revision.Mar 17 2021, 1:03 PM

LGTM aside from a small nit.

clang/include/clang/ASTMatchers/ASTMatchersInternal.h
1564

This change seems unintentional?

This revision is now accepted and ready to land.Mar 17 2021, 1:03 PM
njames93 added inline comments.Mar 17 2021, 1:17 PM
clang/include/clang/ASTMatchers/ASTMatchersInternal.h
1564

I think it's a clang-format being a little eager, not sure though.

njames93 updated this revision to Diff 331353.Mar 17 2021, 1:18 PM

Fix formatting

njames93 marked an inline comment as done.Mar 17 2021, 1:19 PM