This is an archive of the discontinued LLVM Phabricator instance.

[NFC] Add filters to hasNItems and hasNItemsOrMore
ClosedPublic

Authored by Tyker on Feb 21 2020, 8:05 AM.

Diff Detail

Event Timeline

Tyker created this revision.Feb 21 2020, 8:05 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 21 2020, 8:05 AM
jdoerfert added inline comments.
llvm/include/llvm/ADT/STLExtras.h
1525

Do we need to provide a default for Pred (aka. PredTy)? If so, is a function pointer really what we want?

Tyker marked an inline comment as done.Mar 4 2020, 8:29 AM
Tyker added inline comments.
llvm/include/llvm/ADT/STLExtras.h
1525

sadly Pred can't be deduced from a default argument, so we need to specify a default template argument as well.

do you see any particular issues or limitation with Pred being a function pointer when no Predicate is provided ?

jdoerfert accepted this revision.Mar 11 2020, 4:01 PM

Assuming we inline (=eliminate) the default value properly, LGTM.

This revision is now accepted and ready to land.Mar 11 2020, 4:01 PM
Tyker added a comment.Mar 11 2020, 4:23 PM

Assuming we inline (=eliminate) the default value properly, LGTM.

gcc and clang generate exactly the same code before and after the patch https://godbolt.org/z/Zv4-Dg

This revision was automatically updated to reflect the committed changes.