-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[clang][DependencyScanning] Track modules that resolve from "shared" locations #130634
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
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
aca254a
[clang][DependencyScanning] Track modules that resolve from sysroot.
cyndyishida fd4abaa
Add explicit search paths into SDK as they aren't passed with non-dar…
cyndyishida 032d7f8
Address review comments except for prebuilt module dependencies
cyndyishida 175e9ce
Update IsInSysroot -> IsShareable
cyndyishida 274429a
Address review comments
cyndyishida 8f53fac
IsShareable -> IsInStableDirectories
cyndyishida File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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 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 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,108 @@ | ||
| // This test verifies modules that are entirely comprised from sysroot inputs are captured in | ||
| // dependency information. | ||
|
|
||
| // The first compilation verifies that transitive dependencies on non-sysroot input are captured. | ||
| // The second compilation verifies that external paths are resolved when a vfsoverlay is applied when considering sysroot-ness. | ||
|
|
||
| // REQUIRES: shell | ||
| // RUN: rm -rf %t | ||
| // RUN: split-file %s %t | ||
| // RUN: sed -e "s|DIR|%/t|g" %t/compile-commands.json.in > %t/compile-commands.json | ||
| // RUN: sed -e "s|DIR|%/t|g" %t/overlay.json.template > %t/overlay.json | ||
| // RUN: clang-scan-deps -compilation-database %t/compile-commands.json \ | ||
| // RUN: -j 1 -format experimental-full > %t/deps.db | ||
| // RUN: cat %t/deps.db | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t | ||
|
|
||
| // CHECK: "modules": [ | ||
| // CHECK-NEXT: { | ||
| // CHECK: "is-in-sysroot": true, | ||
| // CHECK: "name": "A" | ||
|
|
||
| // Verify that there are no more occurances of sysroot. | ||
| // CHECK-NOT: "is-in-sysroot" | ||
|
|
||
| // CHECK: "name": "A" | ||
| // CHECK: "USE_VFS" | ||
| // CHECK: "name": "B" | ||
| // CHECK: "name": "C" | ||
| // CHECK: "name": "D" | ||
| // CHECK: "name": "NotInSDK" | ||
|
|
||
| //--- compile-commands.json.in | ||
| [ | ||
| { | ||
| "directory": "DIR", | ||
| "command": "clang -c DIR/client.c -isysroot DIR/MacOSX.sdk -IDIR/MacOSX.sdk/usr/include -IDIR/BuildDir -fmodules -fmodules-cache-path=DIR/module-cache -fimplicit-module-maps", | ||
| "file": "DIR/client.c" | ||
| }, | ||
| { | ||
| "directory": "DIR", | ||
| "command": "clang -c DIR/client.c -isysroot DIR/MacOSX.sdk -IDIR/MacOSX.sdk/usr/include -ivfsoverlay DIR/overlay.json -DUSE_VFS -IDIR/BuildDir -fmodules -fmodules-cache-path=DIR/module-cache -fimplicit-module-maps", | ||
| "file": "DIR/client.c" | ||
| } | ||
| ] | ||
|
|
||
| //--- overlay.json.template | ||
| { | ||
| "version": 0, | ||
| "case-sensitive": "false", | ||
| "roots": [ | ||
| { | ||
| "external-contents": "DIR/local/A/A_vfs.h", | ||
| "name": "DIR/MacOSX.sdk/usr/include/A/A_vfs.h", | ||
| "type": "file" | ||
| } | ||
| ] | ||
| } | ||
|
|
||
| //--- MacOSX.sdk/usr/include/A/module.modulemap | ||
| module A { | ||
| umbrella "." | ||
| } | ||
|
|
||
| //--- MacOSX.sdk/usr/include/A/A.h | ||
| #ifdef USE_VFS | ||
| #include <A/A_vfs.h> | ||
| #endif | ||
| typedef int A_t; | ||
|
|
||
| //--- local/A/A_vfs.h | ||
| typedef int typeFromVFS; | ||
|
|
||
| //--- MacOSX.sdk/usr/include/B/module.modulemap | ||
| module B [system] { | ||
| umbrella "." | ||
| } | ||
|
|
||
| //--- MacOSX.sdk/usr/include/B/B.h | ||
| #include <C/C.h> | ||
| typedef int B_t; | ||
|
|
||
| //--- MacOSX.sdk/usr/include/C/module.modulemap | ||
| module C [system] { | ||
| umbrella "." | ||
| } | ||
|
|
||
| //--- MacOSX.sdk/usr/include/C/C.h | ||
| #include <D/D.h> | ||
|
|
||
| //--- MacOSX.sdk/usr/include/D/module.modulemap | ||
| module D [system] { | ||
| umbrella "." | ||
| } | ||
|
|
||
| // Simulate a header that will be resolved in a local directory, from a sysroot header. | ||
| //--- MacOSX.sdk/usr/include/D/D.h | ||
| #include <HeaderNotFoundInSDK.h> | ||
|
|
||
| //--- BuildDir/module.modulemap | ||
| module NotInSDK [system] { | ||
| umbrella "." | ||
| } | ||
|
|
||
| //--- BuildDir/HeaderNotFoundInSDK.h | ||
| typedef int local_t; | ||
|
|
||
| //--- client.c | ||
| #include <A/A.h> | ||
| #include <B/B.h> |
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.