forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 343
[5.9] Cherry-pick missing cas-related commits from stable/20221013
#6618
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
akyrtzi
merged 38 commits into
swiftlang:swift/release/5.9
from
akyrtzi:pr/5.9/cas-cherry-pick
Apr 7, 2023
Merged
[5.9] Cherry-pick missing cas-related commits from stable/20221013
#6618
akyrtzi
merged 38 commits into
swiftlang:swift/release/5.9
from
akyrtzi:pr/5.9/cas-cherry-pick
Apr 7, 2023
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This adds the scaffolding needed for include-tree to push IncludeTreeBuilder stacks, to compute an include-tree for a module and to get fmodule-file-cache-key options for dependencies. Note: this does not yet support building or importing modules, but it lets us compute dependencies in the right way. (cherry picked from commit 3b87a20) (cherry picked from commit 3221056)
This handles building and importing simple modules and PCH with modules using include-tree, when modules are found via header path. * Extend IncludeTree to represent module imports and modulemap mainfile * Make IncludeTreeBuilder add the new nodes for #include * Make PPDirectives import modules from PPCachedActions in #include * Teach FrontendAction/CompilerInvocation how to setup the main input file modulemap and module includes buffer from IncludeTreeRoot. There are still lots of things missing, including @import syntax and submodule semantics. (cherry picked from commit 55b697d) (cherry picked from commit a9db055)
With explicit imports, we do not record the module import in the include tree, because the only thing that happens is to lookup the module by name, which works already via the command-line options that provide the module via the action cache. (cherry picked from commit a13b79f) (cherry picked from commit 232e662)
Instead of looking through the PCH or modules for input files and loading them into the current FileManager while scanning, merge them directly from the include-tree that was used to build that PCH and/or module. This makes it easier to understand where files come from in the include-tree, and eliminates certain issues where the scanner module may include more files than are necessary, or include them with different paths in the case of VFS/symlinks. It also avoids needing to re-stat these files if they are not used during scanning the importing TU. As part of this, we teach IncludeTreeFilesystem to handle ./ stripping in paths to match what ASTWriter does. (cherry picked from commit 4c3f73e) (cherry picked from commit fcf503d)
Instead of putting the modulemap file in the include-tree filesystem and parsing it at build time, create a data structure that represents just the parts of the modulemap we need when building the module: * Flags (explicit, system, framework, etc.) * Exports (export *, export Foo) * LinkLibraries (implicit framework autolink, link Foo) Additionally, we add modular headers lazily by inserting known headers when we encounter an include-tree header that is part of a submodule (this is needed for missing #include diagnostics). This removes the possibility of mismatches between header paths seen during modulemap parsing from the paths we embed due to #includes, for exmaple due to VFS virtual vs external paths. (cherry picked from commit a237e68) Conflicts: clang/include/clang/Basic/Module.h clang/lib/Serialization/ASTWriter.cpp (cherry picked from commit c6b9298)
Instead of flattening file lists when importing PCH/modules, just create a chained reference to the list and flatten it only in FileList::forEachFile. This reduces the storage cost and performance overhead of merging file lists. (cherry picked from commit ee7ddda) (cherry picked from commit 2fbfa49)
If we see the same File or FileList more than once, skip visiting it again. This improves performance if the same module is reached through multiple dependency chains, or the same file is in multiple modules/PCH/TU file lists explicitly. (cherry picked from commit 591fa52) (cherry picked from commit 653e01b)
* Framework autolink is not automatic unless the binary exists * Inputs are sorted by name in dep scan
…ules When an inferred submodule is missing, because the umbrella header does not actually include it, we need to fall back to textual include. This was not working when included via PCH, because we were not serializing the inference flag(s) in the include-tree. rdar://107281193 (cherry picked from commit ecf7946)
In 6034ccd we fixed an issue where if a public module is imported via PCH we cannot import the private module in a TU because the modulemap is not parsed. This is also an issue when building a module that imports the private module and the TU used a PCH, because even though we don't import the PCH itself, we still use the prebuilt/explicit module found via the PCH instead of building an implicit scanner module. This commit generalizes the original fix to handle all prebuilt/explicit modules. rdar://107446573 (cherry picked from commit 159fe25)
…m modules When not performing codegen, we can strip the coverage-data-file and coverage-notes-file options to improve canonicalization. rdar://107443796 Differential Revision: https://reviews.llvm.org/D147282 (cherry picked from commit 758bca6)
Companion to https://reviews.llvm.org/D147282; when caching a PCH, remove the -coverage-data-file and -coverage-notes-file options. These paths cannot currently be prefix-mapped, because they are emitted into the binary for the coverage runtime to use. However, they have no effect on PCH, so remove them. rdar://107443796 (cherry picked from commit 0d086a5) (cherry picked from commit eb9236e)
Centralize the handling of prefix mapping options so that the driver is responsible for lowering `-fdepscan-prefix-map-sdk` and `-fdepscan-prefix-map-toolchain` to use `-fdepscan-prefix-map`, and all the tools take their prefix mappings from `FrontendOptions::PathPrefixMappings` instead of each having their own handling. This makes it easier for new code paths to use prefix mapping, since they get configuration "for free". cc1depscan[d] no longer needs special handling of these options at all, and in tests we just move to the driver or cc1 options. For clang-scan-deps it's move convenient to keep the command-line options, but implement them in the argument adjuster by adding the right driver options. rdar://106307646 (cherry picked from commit 5f5cf44)
For rdar://106307646
For rdar://106307646
…> _Private While we eventually want to remove the mapping from .Private to _Private modules, until we do, ensure that it behaves the same for explicit modules. rdar://107449872 Differential Revision: https://reviews.llvm.org/D147477 (cherry picked from commit 8ec36e6)
This is useful so we can evolve the reported scanning information without breaking ABI. (cherry picked from commit 5577930)
… `clang_experimental_DepGraph_getDiagnostics` The `StoredDiagnostic`s captured from the `getFileDependencies()` call reference a `SourceManager` object that gets destroyed and is invalid to use for getting diagnostic location info. To address this, capture diagnostics as a serialized diagnostics buffer and "materialize" it for the `clang_experimental_DepGraph_getDiagnostics` call, by re-using existing libclang machinery for loading serialized diagnostics. Also delete `clang_experimental_DependencyScannerWorker_getFileDependencies_v5` since it's unsafe to use to get diagnostics and its functionality is superseeded by `clang_experimental_DependencyScannerWorker_getDepGraph`. rdar://105978877 (cherry picked from commit 397a30d)
…anning output Also add translation unit and module cache keys in the json output of `clang-scan-deps` for testing purposes. (cherry picked from commit c1784bd)
… dep-scan API (cherry picked from commit b5ca714)
…ee output is requested It has overhead that is not needed for the include-tree mechanism. (cherry picked from commit 32bd17b)
rdar://107634986 (cherry picked from commit 3c2b29f)
@swift-ci Please test |
Fix doxygen warning: '\c' command does not have a valid word argument [-Wdocumentation]
swiftlang/swift#65002 |
1 similar comment
swiftlang/swift#65002 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.