mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 10:54:49 +01:00
Cleanup pass over llvm::seq uses (#5185)
I was thinking about this after `seq` changes in #5182, and looked for other uses that might be replaceable. Here's the resulting cleanup around `seq`: - Switch to `enumerate` or `zip` when possible. - `int _` -> `auto _` (it's typically a `size_t`, but there's no reason to cast when unused) - Fix a case of cast style `(size_t)...` -> `static_cast<size_t>(...)` - Switch `(void)close_children_count` to `[[maybe_unused]]`
This commit is contained in:
@@ -34,10 +34,10 @@ class CompileBenchmark {
|
||||
auto SetUpFiles(llvm::ArrayRef<std::string> sources)
|
||||
-> llvm::OwningArrayRef<std::string> {
|
||||
llvm::OwningArrayRef<std::string> file_names(sources.size());
|
||||
for (ssize_t i : llvm::seq<ssize_t>(sources.size())) {
|
||||
file_names[i] = llvm::formatv("file_{0}.carbon", i).str();
|
||||
fs_->addFile(file_names[i], /*ModificationTime=*/0,
|
||||
llvm::MemoryBuffer::getMemBuffer(sources[i]));
|
||||
for (auto [i, source, file_name] : llvm::enumerate(sources, file_names)) {
|
||||
file_name = llvm::formatv("file_{0}.carbon", i).str();
|
||||
fs_->addFile(file_name, /*ModificationTime=*/0,
|
||||
llvm::MemoryBuffer::getMemBuffer(source));
|
||||
}
|
||||
return file_names;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user