Debian Codegraph @

clang/test/ClangScanDeps/modules-excluded-header.m

raw
1 // This test checks that we're reporting module maps affecting the compilation by describing excluded headers.
2
3 // RUN: rm -rf %t
4 // RUN: split-file %s %t
5
6 //--- frameworks/X.framework/Modules/module.modulemap
7 framework module X {
8 umbrella header "X.h"
9 exclude header "Excluded.h"
10 }
11 //--- frameworks/X.framework/Headers/X.h
12 //--- frameworks/X.framework/Headers/Excluded.h
13
14 //--- mod/module.modulemap
15 module Mod { header "Mod.h" }
16 //--- mod/Mod.h
17 #include <X/Excluded.h>
18
19 //--- tu.m
20 @import Mod;
21
22 //--- cdb.json.template
23 [{
24 "file": "DIR/tu.m",
25 "directory": "DIR",
26 "command": "clang -fmodules -fmodules-cache-path=DIR/cache -I DIR/mod -F DIR/frameworks -Werror=non-modular-include-in-module -c DIR/tu.m -o DIR/tu.m"
27 }]
28
29 // RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json
30 // RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full > %t/result.json
31 // RUN: cat %t/result.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t
32
33 // CHECK: {
34 // CHECK-NEXT: "modules": [
35 // CHECK-NEXT: {
36 // CHECK-NEXT: "clang-module-deps": [],
37 // CHECK-NEXT: "clang-modulemap-file": "[[PREFIX]]/mod/module.modulemap",
38 // CHECK-NEXT: "command-line": [
39 // CHECK: "-fmodule-map-file=[[PREFIX]]/frameworks/X.framework/Modules/module.modulemap"
40 // CHECK-NOT: "-fmodule-file={{.*}}"
41 // CHECK: ],
42 // CHECK-NEXT: "context-hash": "{{.*}}",
43 // CHECK-NEXT: "file-deps": [
44 // CHECK: ],
45 // CHECK-NEXT: "link-libraries": [],
46 // CHECK-NEXT: "name": "Mod"
47 // CHECK-NEXT: }
48 // CHECK-NEXT: ]
49 // CHECK: }
50
51 // RUN: %deps-to-rsp %t/result.json --module-name=Mod > %t/Mod.cc1.rsp
52 // RUN: %deps-to-rsp %t/result.json --tu-index=0 > %t/tu.rsp
53
54 // RUN: %clang @%t/Mod.cc1.rsp
55 // RUN: %clang @%t/tu.rsp