[clang] c57ca33 - [clang] NFC: Use range-based for loop
Jan Svoboda via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 12 03:13:21 PST 2021
Author: Jan Svoboda
Date: 2021-11-12T12:13:12+01:00
New Revision: c57ca335474704cabeafcd8421600c3c7ccc4484
URL: https://github.com/llvm/llvm-project/commit/c57ca335474704cabeafcd8421600c3c7ccc4484
DIFF: https://github.com/llvm/llvm-project/commit/c57ca335474704cabeafcd8421600c3c7ccc4484.diff
LOG: [clang] NFC: Use range-based for loop
Added:
Modified:
clang/lib/Frontend/CompilerInstance.cpp
Removed:
################################################################################
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp
index 41cc4468de53..ee62d702a762 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/lib/Frontend/CompilerInstance.cpp
@@ -2033,10 +2033,8 @@ CompilerInstance::loadModule(SourceLocation ImportLoc,
SmallVector<StringRef, 2> Best;
unsigned BestEditDistance = (std::numeric_limits<unsigned>::max)();
- for (clang::Module::submodule_iterator J = Module->submodule_begin(),
- JEnd = Module->submodule_end();
- J != JEnd; ++J) {
- unsigned ED = Name.edit_distance((*J)->Name,
+ for (class Module *SubModule : Module->submodules()) {
+ unsigned ED = Name.edit_distance(SubModule->Name,
/*AllowReplacements=*/true,
BestEditDistance);
if (ED <= BestEditDistance) {
@@ -2045,7 +2043,7 @@ CompilerInstance::loadModule(SourceLocation ImportLoc,
BestEditDistance = ED;
}
- Best.push_back((*J)->Name);
+ Best.push_back(SubModule->Name);
}
}
More information about the cfe-commits
mailing list