Debian Codegraph @

clang/test/ClangScanDeps/modules-file-name-as-requested.m

raw
1 // This test checks that the module map paths we're reporting are the as-requested
2 // paths (as opposed to the paths files resolve to after going through VFS overlays).
3
4 // RUN: rm -rf %t
5 // RUN: split-file %s %t
6
7 //--- real/module.modulemap
8 framework module FW { header "Header.h" }
9 //--- real/Header.h
10 //--- overlay.json.template
11 {
12 "case-sensitive": "false",
13 "version": "0",
14 "roots": [
15 {
16 "contents": [
17 {
18 "external-contents" : "DIR/real/Header.h",
19 "name" : "Header.h",
20 "type" : "file"
21 }
22 ],
23 "name": "DIR/frameworks/FW.framework/Headers",
24 "type": "directory"
25 },
26 {
27 "contents": [
28 {
29 "external-contents": "DIR/real/module.modulemap",
30 "name": "module.modulemap",
31 "type": "file"
32 }
33 ],
34 "name": "DIR/frameworks/FW.framework/Modules",
35 "type": "directory"
36 }
37 ]
38 }
39
40 //--- modules/module.modulemap
41 module Importer { header "header.h" }
42 //--- modules/header.h
43 #include <FW/Header.h>
44
45 //--- cdb.json.template
46 [{
47 "file": "DIR/tu.m",
48 "directory": "DIR",
49 "command": "clang -fmodules -fmodules-cache-path=DIR/cache -Werror=non-modular-include-in-module -ivfsoverlay DIR/overlay.json -F DIR/frameworks -I DIR/modules -c DIR/tu.m -o DIR/tu.o"
50 }]
51
52 //--- tu.m
53 @import Importer;
54
55 // RUN: sed -e "s|DIR|%/t|g" %t/overlay.json.template > %t/overlay.json
56 // RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json
57 // RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full > %t/result.json
58
59 // RUN: %deps-to-rsp %t/result.json --module-name=FW > %t/FW.cc1.rsp
60 // RUN: %deps-to-rsp %t/result.json --module-name=Importer > %t/Importer.cc1.rsp
61 // RUN: %deps-to-rsp %t/result.json --tu-index=0 > %t/tu.rsp
62 // RUN: %clang @%t/FW.cc1.rsp
63 // RUN: %clang @%t/Importer.cc1.rsp
64 // RUN: %clang @%t/tu.rsp