This is an archive of the discontinued LLVM Phabricator instance.

Special case 0 and 1 matcher in makeAllOfComposite().
ClosedPublic

Authored by sbenza on Oct 8 2014, 10:05 AM.

Details

Summary

Remove unnecessary wrapping for the 0 and 1 matcher cases of
makeAllOfComposite(). We don't need a variadic wrapper for those cases.
Refactor TrueMatcher to take advandage of the new conversions between
DynTypedMatcher and Matcher<T>. Also, make it a singleton.
This change improves our clang-tidy related benchmarks by ~12%.

Diff Detail

Repository
rL LLVM

Event Timeline

sbenza updated this revision to Diff 14581.Oct 8 2014, 10:05 AM
sbenza retitled this revision from to Special case 0 and 1 matcher in makeAllOfComposite()..
sbenza updated this object.
sbenza edited the test plan for this revision. (Show Details)
sbenza added a reviewer: klimek.
sbenza added a subscriber: Unknown Object (MLST).
klimek accepted this revision.Oct 9 2014, 2:31 AM
klimek edited edge metadata.

lg

include/clang/ASTMatchers/ASTMatchersInternal.h
450 ↗(On Diff #14581)

What is this needed for? I'd prefer if we could get rid of it, but if not, it should have a comment explaining it (so we can take it out if we don't need it any more).

This revision is now accepted and ready to land.Oct 9 2014, 2:31 AM
sbenza updated this revision to Diff 14666.Oct 9 2014, 11:32 AM
sbenza edited edge metadata.

Added comment

include/clang/ASTMatchers/ASTMatchersInternal.h
450 ↗(On Diff #14581)

Matcher(DynTypedMatcher) is private because it is essentially "unsafe". You can easily create a matcher that matches nothing.
It is only called by explicit conversions like Matcher<T>::dynCastTo<U> and DynTypedMatcher::unconditionalConvertTo<T>. The friendship is for those functions.

sbenza closed this revision.Oct 9 2014, 12:38 PM
sbenza updated this revision to Diff 14669.

Closed by commit rL219431 (authored by @sbenza).