mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Serialize search paths when building an app, for a better debugging experience.
There's also a testing option, -serialize-debugging-options, to force this extra info to be serialized even for library targets. In the long run we'll probably write out this information for all targets, but strip it out of the "public module" when a framework is built. (That way it ends up in the debug info's copy of the module.) Incidentally, this commit includes the ability to add search paths to the Clang importer on the fly, which is most of rdar://problem/16347147. Unfortunately there's no centralized way to add search paths to both Clang /and/ Swift at the moment. Part of rdar://problem/17670778 Swift SVN r24545
This commit is contained in:
@@ -690,6 +690,12 @@ ModuleFile::ModuleFile(
|
||||
Bits.HasUnderlyingModule = hasUnderlyingModule;
|
||||
break;
|
||||
}
|
||||
case input_block::SEARCH_PATH: {
|
||||
bool isFramework;
|
||||
input_block::SearchPathLayout::readRecord(scratch, isFramework);
|
||||
SearchPaths.push_back({blobData, isFramework});
|
||||
break;
|
||||
}
|
||||
default:
|
||||
// Unknown input kind, possibly for use by a future version of the
|
||||
// module format.
|
||||
@@ -876,13 +882,22 @@ ModuleStatus ModuleFile::associateWithFileContext(FileUnit *file,
|
||||
return error(ModuleStatus::TargetTooNew);
|
||||
}
|
||||
|
||||
auto clangImporter = static_cast<ClangImporter *>(ctx.getClangModuleLoader());
|
||||
|
||||
for (const auto &searchPathPair : SearchPaths) {
|
||||
if (searchPathPair.second) {
|
||||
ctx.SearchPathOpts.FrameworkSearchPaths.push_back(searchPathPair.first);
|
||||
} else {
|
||||
ctx.SearchPathOpts.ImportSearchPaths.push_back(searchPathPair.first);
|
||||
}
|
||||
clangImporter->addSearchPath(searchPathPair.first, searchPathPair.second);
|
||||
}
|
||||
|
||||
bool missingDependency = false;
|
||||
for (auto &dependency : Dependencies) {
|
||||
assert(!dependency.isLoaded() && "already loaded?");
|
||||
|
||||
if (dependency.isHeader()) {
|
||||
auto clangImporter =
|
||||
static_cast<ClangImporter *>(ctx.getClangModuleLoader());
|
||||
// The path may be empty if the file being loaded is a partial AST,
|
||||
// and the current compiler invocation is a merge-modules step.
|
||||
if (!dependency.RawPath.empty()) {
|
||||
|
||||
Reference in New Issue
Block a user