xref: /llvm-project/clang/test/ClangScanDeps/modules-canononical-module-map-case.c (revision 68eb3b202f30a1c3f2575f44b9d16365258e66b6)
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 }
42 
43 //--- cdb.json.in
44 [{
45   "directory": "DIR",
46   "file": "DIR/tu.m",
47   "command": "clang -fmodules -fmodules-cache-path=DIR/cache -ivfsoverlay DIR/overlay.json -F DIR/frameworks -c DIR/tu.m -o DIR/tu.o"
48 }]
49 
50 // RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.in > %t/cdb.json
51 // RUN: sed -e "s|DIR|%/t|g" %t/overlay.json.in > %t/overlay.json
52 // RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full > %t/result.json
53 // RUN: cat %t/result.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t
54 
55 // CHECK:      {
56 // CHECK-NEXT:   "modules": [
57 // CHECK-NEXT:     {
58 // CHECK-NEXT:       "clang-module-deps": [],
59 // CHECK-NEXT:       "clang-modulemap-file": "[[PREFIX]]/frameworks/FW.framework/Modules/module.modulemap",
60 // CHECK-NEXT:       "command-line": [
61 // CHECK:              "-x"
62 // CHECK-NEXT:         "objective-c"
63 // CHECK-NEXT:         "[[PREFIX]]/frameworks/FW.framework/Modules/module.modulemap"
64 // CHECK:            ],
65 // CHECK-NEXT:       "context-hash": "{{.*}}",
66 // CHECK-NEXT:       "file-deps": [
67 // CHECK:            ],
68 // CHECK-NEXT:       "link-libraries": [
69 // CHECK-NEXT:         {
70 // CHECK-NEXT:           "isFramework": true,
71 // CHECK-NEXT:           "link-name": "FW"
72 // CHECK-NEXT:         }
73 // CHECK-NEXT:       ],
74 // CHECK-NEXT:       "name": "FW"
75 // CHECK-NEXT:     }
76 // CHECK-NEXT:   ]
77 // CHECK:      }
78