[CAS] Improve swift cas options

Using the same CASOption from clang to communicate CAS configurations so
it is easier to exchange CAS configuration between them.
This commit is contained in:
Steven Wu
2023-06-12 15:33:35 -07:00
parent b1b16981fe
commit 2b7d38dc16
15 changed files with 289 additions and 39 deletions

View File

@@ -238,10 +238,21 @@ void ClangImporter::recordModuleDependencies(
std::string IncludeTree =
clangModuleDep.IncludeTreeID ? *clangModuleDep.IncludeTreeID : "";
if (!RootID.empty() || !IncludeTree.empty()) {
if (ctx.ClangImporterOpts.CASOpts) {
swiftArgs.push_back("-enable-cas");
swiftArgs.push_back("-cas-path");
swiftArgs.push_back(ctx.ClangImporterOpts.CASPath);
if (!ctx.ClangImporterOpts.CASOpts->CASPath.empty()) {
swiftArgs.push_back("-cas-path");
swiftArgs.push_back(ctx.ClangImporterOpts.CASOpts->CASPath);
}
if (!ctx.ClangImporterOpts.CASOpts->PluginPath.empty()) {
swiftArgs.push_back("-cas-plugin-path");
swiftArgs.push_back(ctx.ClangImporterOpts.CASOpts->PluginPath);
for (auto Opt : ctx.ClangImporterOpts.CASOpts->PluginOptions) {
swiftArgs.push_back("-cas-plugin-option");
swiftArgs.push_back(
(llvm::Twine(Opt.first) + "=" + Opt.second).str());
}
}
}
if (!RootID.empty()) {
@@ -334,10 +345,20 @@ void ClangImporter::recordBridgingHeaderOptions(
llvm::for_each(clangArgs, addClangArg);
if (!ctx.ClangImporterOpts.CASPath.empty()) {
if (ctx.ClangImporterOpts.CASOpts) {
swiftArgs.push_back("-enable-cas");
swiftArgs.push_back("-cas-path");
swiftArgs.push_back(ctx.ClangImporterOpts.CASPath);
if (!ctx.ClangImporterOpts.CASOpts->CASPath.empty()) {
swiftArgs.push_back("-cas-path");
swiftArgs.push_back(ctx.ClangImporterOpts.CASOpts->CASPath);
}
if (!ctx.ClangImporterOpts.CASOpts->PluginPath.empty()) {
swiftArgs.push_back("-cas-plugin-path");
swiftArgs.push_back(ctx.ClangImporterOpts.CASOpts->PluginPath);
for (auto Opt : ctx.ClangImporterOpts.CASOpts->PluginOptions) {
swiftArgs.push_back("-cas-plugin-option");
swiftArgs.push_back((llvm::Twine(Opt.first) + "=" + Opt.second).str());
}
}
}
if (auto Tree = deps.IncludeTreeID) {