This is an archive of the discontinued LLVM Phabricator instance.

[ASTMatchers] Add argumentCountAtLeast narrowing matcher
ClosedPublic

Authored by mikecrowe on Jun 24 2023, 11:43 PM.

Details

Summary

This will be used by the modernize-use-std-print clang-tidy check and
related checks later.

Diff Detail

Event Timeline

mikecrowe created this revision.Jun 24 2023, 11:43 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 24 2023, 11:43 PM
mikecrowe requested review of this revision.Jun 24 2023, 11:43 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 24 2023, 11:43 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
mikecrowe added inline comments.Jun 24 2023, 11:45 PM
clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
1671

I'm not sure if this is the best way to trigger testing of the ignoring default argument path in the implementation of argumentCountAtLeast, but it does seem to work. I added explicit TK_AsIs to the tests above to make it clear that they are not testing that path.

PiotrZSL accepted this revision.EditedJun 25 2023, 8:49 AM

LGTM, Personally probably I wouldn't extract this to this level, and I would leave it private to a check, but it's fine.

This revision is now accepted and ready to land.Jun 25 2023, 8:49 AM
NOTE: Registry.cpp were not changed, I will add it there during commit if all tests locally pass. If tests fail, I will just add this matcher as private in clang-tidy check.
PiotrZSL updated this revision to Diff 534363.Jun 25 2023, 10:35 AM

Rebase + Added change to Registry.cpp

This revision was automatically updated to reflect the committed changes.