Skip to content

Commit ab6ef58

Browse files
committed
[clang] NFC: Format a loop in CompilerInstance
This code will be moved to a separate function in a future patch. Reformatting now to prevent a bunch of clang-format complains on Phabricator.
1 parent 99ff697 commit ab6ef58

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

clang/lib/Frontend/CompilerInstance.cpp

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2008,10 +2008,9 @@ CompilerInstance::loadModule(SourceLocation ImportLoc,
20082008
PrivateModule, PP->getIdentifierInfo(Module->Name)->getTokenID());
20092009
PrivPath.push_back(std::make_pair(&II, Path[0].second));
20102010

2011-
if (PP->getHeaderSearchInfo().lookupModule(PrivateModule, ImportLoc,
2012-
true, !IsInclusionDirective))
2013-
Sub =
2014-
loadModule(ImportLoc, PrivPath, Visibility, IsInclusionDirective);
2011+
if (PP->getHeaderSearchInfo().lookupModule(PrivateModule, ImportLoc, true,
2012+
!IsInclusionDirective))
2013+
Sub = loadModule(ImportLoc, PrivPath, Visibility, IsInclusionDirective);
20152014
if (Sub) {
20162015
MapPrivateSubModToTopLevel = true;
20172016
if (!getDiagnostics().isIgnored(
@@ -2034,9 +2033,9 @@ CompilerInstance::loadModule(SourceLocation ImportLoc,
20342033
unsigned BestEditDistance = (std::numeric_limits<unsigned>::max)();
20352034

20362035
for (class Module *SubModule : Module->submodules()) {
2037-
unsigned ED = Name.edit_distance(SubModule->Name,
2038-
/*AllowReplacements=*/true,
2039-
BestEditDistance);
2036+
unsigned ED =
2037+
Name.edit_distance(SubModule->Name,
2038+
/*AllowReplacements=*/true, BestEditDistance);
20402039
if (ED <= BestEditDistance) {
20412040
if (ED < BestEditDistance) {
20422041
Best.clear();
@@ -2049,12 +2048,11 @@ CompilerInstance::loadModule(SourceLocation ImportLoc,
20492048

20502049
// If there was a clear winner, user it.
20512050
if (Best.size() == 1) {
2052-
getDiagnostics().Report(Path[I].second,
2053-
diag::err_no_submodule_suggest)
2054-
<< Path[I].first << Module->getFullModuleName() << Best[0]
2055-
<< SourceRange(Path[0].second, Path[I-1].second)
2056-
<< FixItHint::CreateReplacement(SourceRange(Path[I].second),
2057-
Best[0]);
2051+
getDiagnostics().Report(Path[I].second, diag::err_no_submodule_suggest)
2052+
<< Path[I].first << Module->getFullModuleName() << Best[0]
2053+
<< SourceRange(Path[0].second, Path[I - 1].second)
2054+
<< FixItHint::CreateReplacement(SourceRange(Path[I].second),
2055+
Best[0]);
20582056

20592057
Sub = Module->findSubmodule(Best[0]);
20602058
}
@@ -2064,8 +2062,8 @@ CompilerInstance::loadModule(SourceLocation ImportLoc,
20642062
// No submodule by this name. Complain, and don't look for further
20652063
// submodules.
20662064
getDiagnostics().Report(Path[I].second, diag::err_no_submodule)
2067-
<< Path[I].first << Module->getFullModuleName()
2068-
<< SourceRange(Path[0].second, Path[I-1].second);
2065+
<< Path[I].first << Module->getFullModuleName()
2066+
<< SourceRange(Path[0].second, Path[I - 1].second);
20692067
break;
20702068
}
20712069

0 commit comments

Comments
 (0)