[Serialization] Keep track of whether a module has an underlying Clang module.

Previously, we depended on whether or not a serialized module was located
within a framework bundle to consider whether or not it may have a "Clang
half". However, LLDB loads serialized modules from dSYM bundles. Rather
than try to figure out if such a module is "really" a framework, just track
whether the original module was built with -import-underlying-module. If so,
consider the underlying Clang module to be re-exported.

rdar://problem/18099523

Swift SVN r21544
This commit is contained in:
Jordan Rose
2014-08-28 21:36:02 +00:00
parent c3660d5ad6
commit 422565100e
8 changed files with 38 additions and 18 deletions

View File

@@ -580,6 +580,7 @@ ModuleFile::ModuleFile(
}
cursor.EnterSubBlock(INPUT_BLOCK_ID);
bool seenFlags = false;
auto next = cursor.advance();
while (next.Kind == llvm::BitstreamEntry::Record) {
@@ -624,6 +625,14 @@ ModuleFile::ModuleFile(
importedHeaderInfo.contents = blobData;
break;
}
case input_block::MODULE_FLAGS: {
assert(!seenFlags && "only one flags record allowed");
bool hasUnderlyingModule;
input_block::ModuleFlagsLayout::readRecord(scratch,
hasUnderlyingModule);
Bits.HasUnderlyingModule = hasUnderlyingModule;
break;
}
default:
// Unknown input kind, possibly for use by a future version of the
// module format.
@@ -865,7 +874,7 @@ bool ModuleFile::associateWithFileContext(FileUnit *file, SourceLoc diagLoc) {
return false;
}
if (Bits.IsFramework)
if (Bits.HasUnderlyingModule)
(void)getModule(FileContext->getParentModule()->Name);
return getStatus() == ModuleStatus::Valid;
@@ -936,7 +945,7 @@ void ModuleFile::getImportedModules(
Module::ImportFilter filter) {
PrettyModuleFileDeserialization stackEntry(*this);
bool includeShadowedModule = (filter != Module::ImportFilter::Private &&
ShadowedModule && Bits.IsFramework);
ShadowedModule && Bits.HasUnderlyingModule);
for (auto &dep : Dependencies) {
if (filter != Module::ImportFilter::All &&