Commit Graph

8 Commits

Author SHA1 Message Date
Artem Chikin
abec212b60 [Dependency Scan] On cross-import overlay discovery, do not exit on main module... 2023-10-27 15:45:24 -07:00
Artem Chikin
306f5b936d [Dependency Scanning] On discovering cross-import overlays, do not add their discovered dependencies to the main module's direct dependencies
Instead, only add the overlay itself, and let it refer to its own dependencies, which will still get recorded in the overall output.

Resolves rdar://117010118
2023-10-20 15:35:30 -07:00
Artem Chikin
9615729d0b [Dependency Scanning] Handle binary module dependencies' Swift overlay dependencies
The code, previously, only properly handled such dependencies being a distinct category for Swift source and Swift textual dependency infos. Swift binary module dependencies must handle this similarly and this change adds the missing support for them. Recent refactor of the scanner also means that now Swift binary dependencies with Swift overlay dependencies may crash the scanner, and this change resolves this as well.

Resolves rdar://117088840
2023-10-18 09:46:34 -07:00
Steven Wu
c8bc08107c Merge pull request #68684 from cachemeifyoucan/eng/PR-path-remapping
[CompilerCaching] Path Remapping for canonicalization
2023-10-04 12:57:27 -07:00
Artem Chikin
64b18f5b72 [Dependency Scanning] Post-process imports that fail to resolve against the cache entries added by other resolved imports
It is possible that import resolution failed because we are attempting to resolve a module which can only be brought in via a modulemap of a different Clang module dependency which is not otherwise on the current search paths. For example, suppose we are scanning a '.swiftinterface' for module 'Foo', which contains:
'''
@_exported import Foo
import Bar
...
Where 'Foo' is the underlying Framework clang module whose '.modulemap' defines an auxiliary module 'Bar'. Because 'Foo' is a framework, its modulemap is under '<some_framework_search_path>/Foo.framework/Modules/module.modulemap'. Which means that lookup of `Bar` alone from Swift will not be able to locate the module in it. However, the lookup of Foo will itself bring in the auxiliary module becuase the Clang scanner instance scanning for clang module Foo will be able to find it in the corresponding framework module's modulemap and register it as a dependency which means it will be registered with the scanner's cache in the step above. To handle such cases, we first add all successfully-resolved modules and (for Clang modules) their transitive dependencies to the cache, and then attempt to re-query imports for which resolution originally failed from the cache. If this fails, then the scanner genuinely failed to resolve this dependency.
2023-09-29 13:06:27 -07:00
Artem Chikin
1828beabaf [Dependency Scanning ]Revert: Remove Swift Overlay dependencies from the set of direct dependencies 2023-09-26 13:59:33 -07:00
Steven Wu
7b89afbb6e [DepScan] Teach dependency scanner to remap path for canonicalization
Allow DependencyScanner to canonicalize path using a prefix map. When
option `-scanner-prefix-map` option is used, dependency scanner will
remap all the input paths in following:
* all the paths in the CAS file system or clang include tree
* all the paths related to input on the command-line returned by scanner

This allows all the input paths to be canonicalized so cache key can be
computed reguardless of the exact on disk path.

The sourceFile field is not remapped so build system can track the exact
file as on the local file system.
2023-09-26 12:36:43 -07:00
Artem Chikin
b4dfb6baa1 [Dependency Scanning] Implement parallel imported module resolution
'ModuleDependencyScanner' maintains a Thread Pool along with a pool of workers
which are capable of executing a filesystem lookup of a named module dependency.
When resolving imports of a given Swift module, each import's resolution
operation can be issued asunchronously.
2023-09-22 14:11:26 -07:00