Debian Codegraph @

clang/test/ClangScanDeps/modules-current-modulemap-file-dep.c

raw
1 // RUN: rm -rf %t
2 // RUN: split-file %s %t
3
4 // RUN: sed -e "s|DIR|%/t|g" %t/vfs.yaml.in > %t/vfs.yaml
5
6 // RUN: clang-scan-deps -format experimental-full -j 1 -- \
7 // RUN: %clang -ivfsoverlay %t/vfs.yaml -fmodules -fimplicit-module-maps \
8 // RUN: -fmodules-cache-path=%t/cache -fmodule-name=ModuleName \
9 // RUN: -I %/t/remapped -c %t/header-impl.c -o %t/header-impl.o \
10 // RUN: | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t
11
12 // CHECK: "command-line": [
13 // CHECK: "-fmodule-map-file=[[PREFIX]]/remapped/module.modulemap"
14 // CHECK: "file-deps": [
15 // CHECK: "[[PREFIX]]/original/module.modulemap"
16
17 // Verify that "file-deps" references actual on-disk module map and not using the virtual path.
18
19 //--- vfs.yaml.in
20 {
21 "version": 0,
22 "case-sensitive": "false",
23 "roots": [
24 {
25 "name": "DIR/remapped",
26 "type": "directory",
27 "contents": [
28 {
29 "name": "module.modulemap",
30 "type": "file",
31 "external-contents": "DIR/original/module.modulemap"
32 },
33 {
34 "name": "header.h",
35 "type": "file",
36 "external-contents": "DIR/original/header.h"
37 }
38 ]
39 }
40 ]
41 }
42
43 //--- original/module.modulemap
44 module ModuleName {
45 header "header.h"
46 export *
47 }
48
49 //--- original/header.h
50 int foo_function(void);
51
52 //--- header-impl.c
53 #include <header.h>
54
55 int foo_function(void) {
56 return 0;
57 }