1 // Ensure the path to the modulemap input is included in the module context hash
2 // irrespective of other TU command-line arguments, as it effects the canonical
3 // module build command. In this test we use the difference in spelling between
4 // module.modulemap and module.map, but it also applies to situations such as
5 // differences in case-insensitive paths if they are not canonicalized away.
8 // RUN: split-file %s %t
9 // RUN: sed "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json
11 // RUN: clang-scan-deps -compilation-database %t/cdb.json -j 1 \
12 // RUN: -format experimental-full > %t/deps.json
14 // RUN: mv %t/module.modulemap %t/module.map
15 // RUN: echo 'AFTER_MOVE' >> %t/deps.json
17 // RUN: clang-scan-deps -compilation-database %t/cdb.json -j 1 \
18 // RUN: -format experimental-full >> %t/deps.json
20 // RUN: cat %t/deps.json | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t %s
23 // CHECK-NEXT: "modules": [
25 // CHECK: "command-line": [
26 // CHECK: "{{.*}}module.modulemap"
28 // CHECK: "context-hash": "[[HASH1:.*]]"
29 // CHECK: "name": "Mod"
32 // CHECK-NEXT: "translation-units": [
34 // CHECK: "clang-module-deps": [
36 // CHECK-NEXT: "context-hash": "[[HASH1]]"
37 // CHECK-NEXT: "module-name": "Mod"
40 // CHECK-LABEL: AFTER_MOVE
42 // CHECK-NEXT: "modules": [
44 // CHECK-NOT: [[HASH1]]
45 // CHECK: "command-line": [
46 // CHECK: "{{.*}}module.map"
48 // CHECK-NOT: [[HASH1]]
49 // CHECK: "name": "Mod"
52 // CHECK-NEXT: "translation-units": [
54 // CHECK: "clang-module-deps": [
56 // CHECK-NEXT: "context-hash":
57 // CHECK-NOT: [[HASH1]]
58 // CHECK-NEXT: "module-name": "Mod"
62 //--- cdb.json.template
66 "command": "clang -fsyntax-only DIR/tu.c -fmodules -fimplicit-module-maps -fmodules-cache-path=DIR/cache",
71 //--- module.modulemap
72 module Mod
{ header
"Mod.h" }