[Caching][Macro] Make macro plugin options cacheable

Currently, the macro plugin options are included as cache key and the
absolute path of the plugin executable and library will affect cache
hit, even the plugin itself is identical.

Using the new option `-resolved-plugin-validation` flag, the macro
plugin paths are remapped just like the other paths during dependency
scanning. `swift-frontend` will unmap to its original path during the
compilation, make sure the content hasn't changed, and load the plugin.
It also hands few other corner cases for macro plugins:

* Make sure the plugin options in the swift module is prefix mapped.
* Make sure the remarks of the macro loading is not cached, as the
  mesasge includes the absolute path of the plugin, and is not
  cacheable.

rdar://148465899
This commit is contained in:
Steven Wu
2025-04-02 15:19:10 -07:00
parent 3490c73e6a
commit 3d38d0dd56
12 changed files with 174 additions and 11 deletions

View File

@@ -2417,6 +2417,9 @@ static bool ParseSearchPathArgs(SearchPathOptions &Opts, ArgList &Args,
Opts.ScannerPrefixMapper.push_back(Opt.str());
}
Opts.ResolvedPluginVerification |=
Args.hasArg(OPT_resolved_plugin_verification);
// rdar://132340493 disable scanner-side validation for non-caching builds
Opts.ScannerModuleValidation |= Args.hasFlag(OPT_scanner_module_validation,
OPT_no_scanner_module_validation,