mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Caching] Create clang importer from cc1 args directly
When caching build is enabled, teach dependency scanner to report command-lines with `-direct-clang-cc1-module-build` so the later compilation can instantiate clang importer with cc1 args directly. This avoids running clang driver code, which might involve file system lookups, which are the file deps that are not captured and might result in different compilation mode. rdar://119275464
This commit is contained in:
@@ -157,10 +157,23 @@ SwiftModuleScanner::scanInterfaceFile(Twine moduleInterfacePath,
|
||||
// Add explicit Swift dependency compilation flags
|
||||
Args.push_back("-explicit-interface-module-build");
|
||||
Args.push_back("-disable-implicit-swift-modules");
|
||||
Args.push_back("-Xcc");
|
||||
Args.push_back("-fno-implicit-modules");
|
||||
Args.push_back("-Xcc");
|
||||
Args.push_back("-fno-implicit-module-maps");
|
||||
|
||||
// Handle clang arguments. For caching build, all arguments are passed
|
||||
// with `-direct-clang-cc1-module-build`.
|
||||
if (Ctx.CASOpts.EnableCaching) {
|
||||
Args.push_back("-direct-clang-cc1-module-build");
|
||||
auto *importer =
|
||||
static_cast<ClangImporter *>(Ctx.getClangModuleLoader());
|
||||
for (auto &Arg : importer->getSwiftExplicitModuleDirectCC1Args()) {
|
||||
Args.push_back("-Xcc");
|
||||
Args.push_back(Arg);
|
||||
}
|
||||
} else {
|
||||
Args.push_back("-Xcc");
|
||||
Args.push_back("-fno-implicit-modules");
|
||||
Args.push_back("-Xcc");
|
||||
Args.push_back("-fno-implicit-module-maps");
|
||||
}
|
||||
for (const auto &candidate : compiledCandidates) {
|
||||
Args.push_back("-candidate-module-file");
|
||||
Args.push_back(candidate);
|
||||
|
||||
Reference in New Issue
Block a user