-
Notifications
You must be signed in to change notification settings - Fork 339
[clang][depscan] Support prefix mappings when deciding modules that come from "stable" directories #10493
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
base: next
Are you sure you want to change the base?
Conversation
The benefit of special handling of modules that come from stable directories is defined away when compiler caching is enabled. So, keeping this check is mostly to ensure the checks still hold when the scanner has to deal with prefix-mappings.
|
from "stable" directories To support compiler caching, clang may strip out common prefixes from paths like the sysroot. When this happens, include both the initial input paths that would get mapped away and the resulting mapped prefix for determining module dependencies that come from stable directories. This is to handle all of the ways paths may come streaming. For example, input paths that represented included headers will contain an absolute paths for handling indirections like vfsoverlays but sysroot's from `CompilerInstance`'s will be mapped.
65052ad
to
8a3842b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sense to me, but I'd like @benlangmuir to take a look too.
clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
Outdated
Show resolved
Hide resolved
@@ -3,7 +3,7 @@ | |||
// RUN: split-file %s %t | |||
// RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json | |||
|
|||
// RUN: %clang -x c-header %t/prefix.h -target x86_64-apple-macos12 -o %t/prefix.pch -fdepscan=inline -fdepscan-include-tree -Xclang -fcas-path -Xclang %t/cas | |||
// RUN: %clang -x c-header %t/prefix.h -target x86_64-apple-macos12 -isysroot %t -o %t/prefix.pch -fdepscan=inline -fdepscan-include-tree -Xclang -fcas-path -Xclang %t/cas |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this change necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, a sysroot is always passed implicitly (through the lit testing configuration) and that doesn't match with the one passed in https://github.com/swiftlang/llvm-project/pull/10493/files#diff-aaa36845ad74ad6019adf78071e73c17d9e5db7080eb49de2605959a742d98faR100
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is that a problem now but wasn't before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The assertion was firing. I think the assertion should always hold unless a build is misconfigured, but I may be missing something.
They're related, but somewhat independent concepts.
|
* Assign the CompilerInstance's PrefixMapper during the ActionController's for compiler caching * Add PCH test
@swift-ci please test LLVM |
PR failures look unrelated and/or already known |
To support compiler caching, clang may strip out common prefixes from
paths like the sysroot. When this happens, include both the initial
input paths that would get mapped away and the resulting mapped prefix
for determining module dependencies that come from stable directories.
This is to handle all of the ways paths may be compared. For example,
input paths that represent included headers will contain an absolute
paths for handling indirections like when vfsoverlays are used,
but also when sysroot's from
CompilerInstance
's are mapped.