-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[clang][DependencyScanning] Add Test Coverage of StabeDirs during By-Name Lookups
#168143
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: main
Are you sure you want to change the base?
Conversation
|
@llvm/pr-subscribers-clang Author: Qiongsi Wu (qiongsiwu) ChangesThis PR adds some test coverage for Full diff: https://github.com/llvm/llvm-project/pull/168143.diff 1 Files Affected:
diff --git a/clang/test/ClangScanDeps/modules-full-by-mult-mod-names.c b/clang/test/ClangScanDeps/modules-full-by-mult-mod-names.c
index 030f7f3427810..e4248e226b7d3 100644
--- a/clang/test/ClangScanDeps/modules-full-by-mult-mod-names.c
+++ b/clang/test/ClangScanDeps/modules-full-by-mult-mod-names.c
@@ -22,20 +22,43 @@ module root1 { header "root1.h"}
// This is here to verify that the "root" directory doesn't clash with name of
// the "root" module.
+// Verify the stable dir path.
+//--- Sysroot/usr/include/SysA/module.modulemap
+module SysA {
+ header "SysA.h"
+}
+
+//--- Sysroot/usr/include/SysA/SysA.h
+int SysVal = 42;
+
//--- cdb.json.template
[{
"file": "",
"directory": "DIR",
- "command": "clang -fmodules -fmodules-cache-path=DIR/cache -I DIR -x c"
+ "command": "clang -fmodules -fmodules-cache-path=DIR/cache -I DIR -isysroot DIR/Sysroot -IDIR/Sysroot/usr/include -x c"
}]
// RUN: sed "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json
-// RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full -module-names=root,root1,direct > %t/result.json
+// RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full -module-names=SysA,root,root1,direct > %t/result.json
// RUN: cat %t/result.json | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t %s
// CHECK: {
// CHECK-NEXT: "modules": [
// CHECK-NEXT: {
+// CHECK-NEXT: "is-in-stable-directories": true,
+// CHECK-NEXT: "clang-module-deps": [],
+// CHECK-NEXT: "clang-modulemap-file": "[[PREFIX]]/Sysroot/usr/include/SysA/module.modulemap",
+// CHECK-NEXT: "command-line": [
+// CHECK: ],
+// CHECK-NEXT: "context-hash": "{{.*}}",
+// CHECK-NEXT: "file-deps": [
+// CHECK-NEXT: "[[PREFIX]]/Sysroot/usr/include/SysA/module.modulemap",
+// CHECK-NEXT: "[[PREFIX]]/Sysroot/usr/include/SysA/SysA.h"
+// CHECK-NEXT: ],
+// CHECK-NEXT: "link-libraries": [],
+// CHECK-NEXT: "name": "SysA"
+// CHECK-NEXT: },
+// CHECK-NEXT: {
// CHECK-NEXT: "clang-module-deps": [
// CHECK-NEXT: {
// CHECK-NEXT: "context-hash": "{{.*}}",
|
a709fe8 to
dfb1a77
Compare
| @@ -0,0 +1,43 @@ | |||
| // UNSUPPORTED: system-windows | |||
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?
| "file": "", | ||
| "directory": "DIR", | ||
| "command": "clang -fmodules -fmodules-cache-path=DIR/cache -isysroot DIR/Sysroot -IDIR/Sysroot/usr/include -x c" | ||
| }] |
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.
If you're invoking clang-scan-deps just once with a compilation database containing single invocation, I suggest using this simpler form instead and drop the .template file and the sed invocation:
clang-scan-deps -format experimental-full -module-names=SysA -o %t/result.json -- %clang -fmodules -fmodules-cache-path=%t/cache -isysroot %t/Sysroot -I%t/Sysroot/usr/include -x c
This PR adds some test coverage for
StableDirsduring by-name lookups.