[clang] 3f61402 - [clang][DependencyScanning] Add Test Coverage of `StabeDirs` during By-Name Lookups (#168143)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 18 10:56:32 PST 2025
Author: Qiongsi Wu
Date: 2025-11-18T10:56:07-08:00
New Revision: 3f614026f9a5af9409acac225516c868e927ac7a
URL: https://github.com/llvm/llvm-project/commit/3f614026f9a5af9409acac225516c868e927ac7a
DIFF: https://github.com/llvm/llvm-project/commit/3f614026f9a5af9409acac225516c868e927ac7a.diff
LOG: [clang][DependencyScanning] Add Test Coverage of `StabeDirs` during By-Name Lookups (#168143)
This PR adds some test coverage for `StableDirs` during by-name lookups.
Added:
clang/test/ClangScanDeps/module-in-stable-dir-by-name.c
Modified:
Removed:
################################################################################
diff --git a/clang/test/ClangScanDeps/module-in-stable-dir-by-name.c b/clang/test/ClangScanDeps/module-in-stable-dir-by-name.c
new file mode 100644
index 0000000000000..742bc2e046ceb
--- /dev/null
+++ b/clang/test/ClangScanDeps/module-in-stable-dir-by-name.c
@@ -0,0 +1,43 @@
+// UNSUPPORTED: system-windows
+// RUN: rm -rf %t
+// RUN: split-file %s %t
+
+// 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 -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=SysA > %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: "translation-units": []
+// CHECK-NEXT: }
More information about the cfe-commits
mailing list