Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use std::ranges::any_of instead of std::any_of #4539

Merged
merged 1 commit into from
Nov 15, 2024

Conversation

danakj
Copy link
Contributor

@danakj danakj commented Nov 15, 2024

This is suggested by clang-tidy's modernize checks, and is a safer coding practice.

This is suggested by clang-tidy's modernize checks, and is a safer
coding practice.
@danakj
Copy link
Contributor Author

danakj commented Nov 15, 2024

cc @jonmeow

@danakj
Copy link
Contributor Author

danakj commented Nov 15, 2024

I see that we suppress readability-use-anyofallof in .clang-tidy which is meant to not suggest this particular change, but it's also coming from modernize-use-ranges.

Copy link
Contributor

@jonmeow jonmeow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG. I'm not sure why the other tidy warning is currently disabled, it was in #1148 so maybe it was just noisy (perhaps a high false-positive or not-interesting rate).

@jonmeow jonmeow added this pull request to the merge queue Nov 15, 2024
Merged via the queue into carbon-language:trunk with commit 9112053 Nov 15, 2024
10 checks passed
@danakj danakj deleted the ranges-anyof branch November 15, 2024 20:08
danakj added a commit to danakj/carbon-lang that referenced this pull request Nov 15, 2024
We do not intend to use std::ranges in the Carbon implementation due to
concerns of compile time cost, largely due to implicit instantiation of
types involved in calling and typechecking the functions and their
requires clauses.

In carbon-language#4539, we converted std::any_of to std::ranges::any_of, but this
replaces that with llvm::any_of from llvm/ADT/STLExtras.h.

This conversion was suggested by the modernize-use-ranges clang-tidy
check. We can keep the check on, and use it to guide conversion to
llvm helpers that do similar things (as was done in this CL now). If
it's being too confusing, then it can be disabled as well.
github-merge-queue bot pushed a commit that referenced this pull request Nov 15, 2024
We do not intend to use std::ranges in the Carbon implementation due to
concerns of compile time cost, largely due to implicit instantiation of
types involved in calling and typechecking the functions and their
requires clauses.

In #4539, we converted std::any_of to std::ranges::any_of, but this
replaces that with llvm::any_of from llvm/ADT/STLExtras.h.

This conversion was suggested by the modernize-use-ranges clang-tidy
check. We can keep the check on, and use it to guide conversion to llvm
helpers that do similar things (as was done in this CL now). If it's
being too confusing, then it can be disabled as well.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants