@@ -299,20 +299,19 @@ Module *HeaderSearch::lookupModule(StringRef ModuleName, StringRef SearchName,
299
299
SourceLocation ImportLoc,
300
300
bool AllowExtraModuleMapSearch) {
301
301
Module *Module = nullptr ;
302
- SearchDirIterator It = nullptr ;
303
302
304
303
// Look through the various header search paths to load any available module
305
304
// maps, searching for a module map that describes this module.
306
- for (It = search_dir_begin (); It != search_dir_end (); ++It ) {
307
- if (It-> isFramework ()) {
305
+ for (DirectoryLookup Dir : search_dir_range () ) {
306
+ if (Dir. isFramework ()) {
308
307
// Search for or infer a module map for a framework. Here we use
309
308
// SearchName rather than ModuleName, to permit finding private modules
310
309
// named FooPrivate in buggy frameworks named Foo.
311
310
SmallString<128 > FrameworkDirName;
312
- FrameworkDirName += It-> getFrameworkDir ()->getName ();
311
+ FrameworkDirName += Dir. getFrameworkDir ()->getName ();
313
312
llvm::sys::path::append (FrameworkDirName, SearchName + " .framework" );
314
313
if (auto FrameworkDir = FileMgr.getDirectory (FrameworkDirName)) {
315
- bool IsSystem = It-> getDirCharacteristic () != SrcMgr::C_User;
314
+ bool IsSystem = Dir. getDirCharacteristic () != SrcMgr::C_User;
316
315
Module = loadFrameworkModule (ModuleName, *FrameworkDir, IsSystem);
317
316
if (Module)
318
317
break ;
@@ -322,12 +321,12 @@ Module *HeaderSearch::lookupModule(StringRef ModuleName, StringRef SearchName,
322
321
// FIXME: Figure out how header maps and module maps will work together.
323
322
324
323
// Only deal with normal search directories.
325
- if (!It-> isNormalDir ())
324
+ if (!Dir. isNormalDir ())
326
325
continue ;
327
326
328
- bool IsSystem = It-> isSystemHeaderDirectory ();
327
+ bool IsSystem = Dir. isSystemHeaderDirectory ();
329
328
// Search for a module map file in this directory.
330
- if (loadModuleMapFile (It-> getDir (), IsSystem,
329
+ if (loadModuleMapFile (Dir. getDir (), IsSystem,
331
330
/* IsFramework*/ false ) == LMM_NewlyLoaded) {
332
331
// We just loaded a module map file; check whether the module is
333
332
// available now.
@@ -339,7 +338,7 @@ Module *HeaderSearch::lookupModule(StringRef ModuleName, StringRef SearchName,
339
338
// Search for a module map in a subdirectory with the same name as the
340
339
// module.
341
340
SmallString<128 > NestedModuleMapDirName;
342
- NestedModuleMapDirName = It-> getDir ()->getName ();
341
+ NestedModuleMapDirName = Dir. getDir ()->getName ();
343
342
llvm::sys::path::append (NestedModuleMapDirName, ModuleName);
344
343
if (loadModuleMapFile (NestedModuleMapDirName, IsSystem,
345
344
/* IsFramework*/ false ) == LMM_NewlyLoaded){
@@ -351,13 +350,13 @@ Module *HeaderSearch::lookupModule(StringRef ModuleName, StringRef SearchName,
351
350
352
351
// If we've already performed the exhaustive search for module maps in this
353
352
// search directory, don't do it again.
354
- if (It-> haveSearchedAllModuleMaps ())
353
+ if (Dir. haveSearchedAllModuleMaps ())
355
354
continue ;
356
355
357
356
// Load all module maps in the immediate subdirectories of this search
358
357
// directory if ModuleName was from @import.
359
358
if (AllowExtraModuleMapSearch)
360
- loadSubdirectoryModuleMaps (*It );
359
+ loadSubdirectoryModuleMaps (Dir );
361
360
362
361
// Look again for the module.
363
362
Module = ModMap.findModule (ModuleName);
0 commit comments