Skip to content

Commit 88ee76d

Browse files
committed
Imported modules only import the stdlib if it exists.
Any configuration where the stdlib doesn't exist is an atypical one, but being more permissive here lets us successfully import many kinds of declarations even without a stdlib. That in turn makes it possible to write IRGen tests that need foreign types and exercise a specific target without restricting the test to only run when building that target.
1 parent 2cfea1f commit 88ee76d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/ClangImporter/ClangImporter.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3082,7 +3082,8 @@ void ClangModuleUnit::getImportedModules(
30823082
switch (filter) {
30833083
case ModuleDecl::ImportFilter::All:
30843084
case ModuleDecl::ImportFilter::Private:
3085-
imports.push_back({ModuleDecl::AccessPathTy(), owner.getStdlibModule()});
3085+
if (auto stdlib = owner.getStdlibModule())
3086+
imports.push_back({ModuleDecl::AccessPathTy(), stdlib});
30863087
break;
30873088
case ModuleDecl::ImportFilter::Public:
30883089
break;

0 commit comments

Comments
 (0)