mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Re-apply "[serialization] Reject loading a module with the wrong case."
This included a test that failed on case-sensitive filesystems. Test fixed. (Aside: Why not just have this fail with "no such module"? Why use a different error? Because even if "import FOO" picks up a module named 'Foo', there may actually be a module named 'FOO' on the system (in another folder), and we should be able to find that. Fixing that is tracked by rdar://problem/18691936.) rdar://problem/15632996 (again) Swift SVN r22856
This commit is contained in:
@@ -504,7 +504,8 @@ ModuleFile::ModuleFile(
|
||||
case CONTROL_BLOCK_ID: {
|
||||
cursor.EnterSubBlock(CONTROL_BLOCK_ID);
|
||||
|
||||
ModuleStatus err = validateControlBlock(cursor, scratch).first;
|
||||
ModuleStatus err;
|
||||
std::tie(err, Name) = validateControlBlock(cursor, scratch);
|
||||
if (err != ModuleStatus::Valid) {
|
||||
error(err);
|
||||
return;
|
||||
@@ -746,6 +747,11 @@ bool ModuleFile::associateWithFileContext(FileUnit *file, SourceLoc diagLoc) {
|
||||
assert(!FileContext && "already associated with an AST module");
|
||||
FileContext = file;
|
||||
|
||||
if (file->getParentModule()->Name.str() != Name) {
|
||||
error(ModuleStatus::NameMismatch);
|
||||
return false;
|
||||
}
|
||||
|
||||
ASTContext &ctx = getContext();
|
||||
bool missingDependency = false;
|
||||
for (auto &dependency : Dependencies) {
|
||||
@@ -1091,8 +1097,7 @@ ModuleFile::collectLinkLibraries(Module::LinkLibraryCallback callback) const {
|
||||
for (auto &lib : LinkLibraries)
|
||||
callback(lib);
|
||||
if (Bits.IsFramework)
|
||||
callback(LinkLibrary(FileContext->getParentModule()->Name.str(),
|
||||
LibraryKind::Framework));
|
||||
callback(LinkLibrary(Name, LibraryKind::Framework));
|
||||
}
|
||||
|
||||
void ModuleFile::getTopLevelDecls(SmallVectorImpl<Decl *> &results) {
|
||||
|
||||
Reference in New Issue
Block a user