@@ -1408,57 +1408,57 @@ bool HeaderSearch::ShouldEnterIncludeFile(Preprocessor &PP,
1408
1408
// Get information about this file.
1409
1409
HeaderFileInfo &FileInfo = getFileInfo (File);
1410
1410
1411
- // FIXME: this is a workaround for the lack of proper modules-aware support
1412
- // for #import / #pragma once
1413
- auto TryEnterImported = [&]() -> bool {
1414
- if (!ModulesEnabled)
1415
- return false ;
1416
- // Ensure FileInfo bits are up to date.
1417
- ModMap.resolveHeaderDirectives (File);
1418
- // Modules with builtins are special; multiple modules use builtins as
1419
- // modular headers, example:
1420
- //
1421
- // module stddef { header "stddef.h" export * }
1422
- //
1423
- // After module map parsing, this expands to:
1424
- //
1425
- // module stddef {
1426
- // header "/path_to_builtin_dirs/stddef.h"
1427
- // textual "stddef.h"
1428
- // }
1429
- //
1430
- // It's common that libc++ and system modules will both define such
1431
- // submodules. Make sure cached results for a builtin header won't
1432
- // prevent other builtin modules from potentially entering the builtin
1433
- // header. Note that builtins are header guarded and the decision to
1434
- // actually enter them is postponed to the controlling macros logic below.
1435
- bool TryEnterHdr = false ;
1436
- if (FileInfo.isCompilingModuleHeader && FileInfo.isModuleHeader )
1437
- TryEnterHdr = ModMap.isBuiltinHeader (File);
1438
-
1439
- // Textual headers can be #imported from different modules. Since ObjC
1440
- // headers find in the wild might rely only on #import and do not contain
1441
- // controlling macros, be conservative and only try to enter textual headers
1442
- // if such macro is present.
1443
- if (!FileInfo.isModuleHeader &&
1444
- FileInfo.getControllingMacro (ExternalLookup))
1445
- TryEnterHdr = true ;
1446
- return TryEnterHdr;
1447
- };
1448
-
1449
1411
// If this is a #import directive, check that we have not already imported
1450
1412
// this header.
1451
1413
if (isImport) {
1452
1414
// If this has already been imported, don't import it again.
1453
1415
FileInfo.isImport = true ;
1454
1416
1417
+ // FIXME: this is a workaround for the lack of proper modules-aware support
1418
+ // for #import / #pragma once
1419
+ auto TryEnterImported = [&]() -> bool {
1420
+ if (!ModulesEnabled)
1421
+ return false ;
1422
+ // Ensure FileInfo bits are up to date.
1423
+ ModMap.resolveHeaderDirectives (File);
1424
+ // Modules with builtins are special; multiple modules use builtins as
1425
+ // modular headers, example:
1426
+ //
1427
+ // module stddef { header "stddef.h" export * }
1428
+ //
1429
+ // After module map parsing, this expands to:
1430
+ //
1431
+ // module stddef {
1432
+ // header "/path_to_builtin_dirs/stddef.h"
1433
+ // textual "stddef.h"
1434
+ // }
1435
+ //
1436
+ // It's common that libc++ and system modules will both define such
1437
+ // submodules. Make sure cached results for a builtin header won't
1438
+ // prevent other builtin modules from potentially entering the builtin
1439
+ // header. Note that builtins are header guarded and the decision to
1440
+ // actually enter them is postponed to the controlling macros logic below.
1441
+ bool TryEnterHdr = false ;
1442
+ if (FileInfo.isCompilingModuleHeader && FileInfo.isModuleHeader )
1443
+ TryEnterHdr = ModMap.isBuiltinHeader (File);
1444
+
1445
+ // Textual headers can be #imported from different modules. Since ObjC
1446
+ // headers find in the wild might rely only on #import and do not contain
1447
+ // controlling macros, be conservative and only try to enter textual
1448
+ // headers if such macro is present.
1449
+ if (!FileInfo.isModuleHeader &&
1450
+ FileInfo.getControllingMacro (ExternalLookup))
1451
+ TryEnterHdr = true ;
1452
+ return TryEnterHdr;
1453
+ };
1454
+
1455
1455
// Has this already been #import'ed or #include'd?
1456
1456
if (PP.alreadyIncluded (File) && !TryEnterImported ())
1457
1457
return false ;
1458
1458
} else {
1459
1459
// Otherwise, if this is a #include of a file that was previously #import'd
1460
1460
// or if this is the second #include of a #pragma once file, ignore it.
1461
- if (( FileInfo.isPragmaOnce || FileInfo.isImport ) && ! TryEnterImported () )
1461
+ if (FileInfo.isPragmaOnce || FileInfo.isImport )
1462
1462
return false ;
1463
1463
}
1464
1464
0 commit comments