Skip to content

Commit 4afc761

Browse files
elshbeccadax
andcommitted
Update lib/FrontendTool/ImportedModules.cpp
Co-authored-by: Becca Royal-Gordon <[email protected]>
1 parent 3c52f06 commit 4afc761

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

lib/FrontendTool/ImportedModules.cpp

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,10 @@ bool swift::emitImportedModules(ModuleDecl *mainModule,
6666
if (!ID)
6767
continue;
6868

69-
// Check if module aliasing was used for an imported module; for example,
70-
// if '-module-alias Foo=Bar' was passed and this module has 'import Foo',
71-
// its corresponding real module name 'Bar' should be emitted.
72-
ImportPath::Module::Builder builderWithRealModuleName;
73-
auto modulePath = ID->getModulePath(/*outRealModuleName=*/&builderWithRealModuleName);
74-
75-
if (!builderWithRealModuleName.get().empty()) {
76-
// Module aliasing was used, so use its real module name
77-
Modules.insert(builderWithRealModuleName.get().front().Item.str());
78-
} else {
79-
// only the top-level name is needed (i.e. A in A.B.C)
80-
Modules.insert(modulePath[0].Item.str());
81-
}
69+
ImportPath::Module::Builder scratch;
70+
auto modulePath = ID->getRealModulePath(scratch);
71+
// only the top-level name is needed (i.e. A in A.B.C)
72+
Modules.insert(modulePath[0].Item.str());
8273
}
8374

8475
// And now look in the C code we're possibly using.

0 commit comments

Comments
 (0)