Skip to content

Commit 84ff38f

Browse files
authored
Merge pull request #31860 from compnerd/directory-layout-unification
Serialization: permit the directory layout on non-Apple targets
2 parents bfb65ec + a5646e1 commit 84ff38f

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

lib/Serialization/SerializedModuleLoader.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -196,18 +196,20 @@ void SerializedModuleLoaderBase::collectVisibleTopLevelModuleNamesImpl(
196196
bool requireTargetSpecificModule = Ctx.LangOpts.Target.isOSDarwin();
197197
forEachDirectoryEntryPath(searchPath, [&](StringRef path) {
198198
auto pathExt = llvm::sys::path::extension(path);
199-
if (requireTargetSpecificModule) {
200-
if (pathExt != moduleSuffix)
201-
return;
202-
if (!checkTargetFiles(path))
199+
200+
if (pathExt != moduleSuffix)
201+
if (requireTargetSpecificModule || pathExt != suffix)
203202
return;
204-
} else {
205-
if (suffix != pathExt)
203+
204+
if (!checkTargetFiles(path)) {
205+
if (requireTargetSpecificModule)
206206
return;
207+
207208
auto stat = fs.status(path);
208209
if (!stat || stat->isDirectory())
209210
return;
210211
}
212+
211213
// Extract module name.
212214
auto name = llvm::sys::path::filename(path).drop_back(pathExt.size());
213215
names.push_back(Ctx.getIdentifier(name));

0 commit comments

Comments
 (0)