Debian Codegraph @

clang/test/ClangScanDeps/modules-canononical-module-map-case.c

raw
1 // This test checks that VFS-mapped module map path has the correct spelling
2 // after canonicalization, even if it was first accessed using different case.
3
4 // RUN: rm -rf %t
5 // RUN: split-file %s %t
6
7 //--- actual/One.h
8 #import <FW/Two.h>
9 //--- actual/Two.h
10 // empty
11 //--- frameworks/FW.framework/Modules/module.modulemap
12 framework module FW {
13 header "One.h"
14 header "Two.h"
15 }
16 //--- tu.m
17 #import <fw/One.h>
18
19 //--- overlay.json.in
20 {
21 "version": 0,
22 "case-sensitive": "false",
23 "roots": [
24 {
25 "contents": [
26 {
27 "external-contents": "DIR/actual/One.h",
28 "name": "One.h",
29 "type": "file"
30 },
31 {
32 "external-contents": "DIR/actual/Two.h",
33 "name": "Two.h",
34 "type": "file"
35 }
36 ],
37 "name": "DIR/frameworks/FW.framework/Headers",
38 "type": "directory"
39 },
40 {
41 "contents": [
42 {
43 "external-contents": "DIR/frameworks/FW.framework/Modules/module.modulemap",
44 "name": "module.modulemap",
45 "type": "file"
46 }
47 ],
48 "name": "DIR/frameworks/FW.framework/Modules",
49 "type": "directory"
50 }
51 ]
52 }
53
54 //--- cdb.json.in
55 [{
56 "directory": "DIR",
57 "file": "DIR/tu.m",
58 "command": "clang -fmodules -fmodules-cache-path=DIR/cache -ivfsoverlay DIR/overlay.json -F DIR/frameworks -c DIR/tu.m -o DIR/tu.o"
59 }]
60
61 // RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.in > %t/cdb.json
62 // RUN: sed -e "s|DIR|%/t|g" %t/overlay.json.in > %t/overlay.json
63 // RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full > %t/result.json
64 // RUN: cat %t/result.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t
65
66 // CHECK: {
67 // CHECK-NEXT: "modules": [
68 // CHECK-NEXT: {
69 // CHECK-NEXT: "clang-module-deps": [],
70 // CHECK-NEXT: "clang-modulemap-file": "[[PREFIX]]/frameworks/FW.framework/Modules/module.modulemap",
71 // CHECK-NEXT: "command-line": [
72 // CHECK: "-x"
73 // CHECK-NEXT: "objective-c"
74 // CHECK-NEXT: "[[PREFIX]]/frameworks/FW.framework/Modules/module.modulemap"
75 // CHECK: ],
76 // CHECK-NEXT: "context-hash": "{{.*}}",
77 // CHECK-NEXT: "file-deps": [
78 // CHECK: ],
79 // CHECK-NEXT: "link-libraries": [
80 // CHECK-NEXT: {
81 // CHECK-NEXT: "isFramework": true,
82 // CHECK-NEXT: "link-name": "FW"
83 // CHECK-NEXT: }
84 // CHECK-NEXT: ],
85 // CHECK-NEXT: "name": "FW"
86 // CHECK-NEXT: }
87 // CHECK-NEXT: ]
88 // CHECK: }