Skip to content

Commit a7ae091

Browse files
committed
[clang][include-tree] Add test
1 parent 729fa59 commit a7ae091

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// REQUIRES: ondisk_cas
2+
3+
// This test checks that imports of transitively-loaded implementation module
4+
// are not marked as spurious.
5+
6+
// RUN: rm -rf %t
7+
// RUN: split-file %s %t
8+
// RUN: sed "s|DIR|%/t|g" %t/cdb.json.in > %t/cdb.json
9+
10+
//--- cdb.json.in
11+
[{
12+
"file": "DIR/tu.m",
13+
"directory": "DIR",
14+
"command": "clang -c DIR/tu.m -o DIR/tu.o -F DIR/frameworks -fmodules -fmodule-name=FW -fmodules-cache-path=DIR/module-cache"
15+
}]
16+
17+
//--- frameworks/FW.framework/Modules/module.modulemap
18+
framework module FW { umbrella header "FW.h" }
19+
//--- frameworks/FW.framework/Headers/FW.h
20+
#include <FW/Sub.h>
21+
//--- frameworks/FW.framework/Headers/Sub.h
22+
23+
//--- module.modulemap
24+
module Mod { header "Mod.h" }
25+
//--- Mod.h
26+
#include <FW/Sub.h>
27+
//--- tu.m
28+
#include "Mod.h"
29+
#include <FW/Sub.h>
30+
31+
// RUN: clang-scan-deps -compilation-database %t/cdb.json \
32+
// RUN: -format experimental-include-tree-full -cas-path %t/cas \
33+
// RUN: -module-files-dir %t/cas-outputs > %t/cas-deps.json
34+
35+
// RUN: %deps-to-rsp %t/cas-deps.json --module-name=FW > %t/cas-FW.cc1.rsp
36+
// RUN: %deps-to-rsp %t/cas-deps.json --module-name=Mod > %t/cas-Mod.cc1.rsp
37+
// RUN: %deps-to-rsp %t/cas-deps.json --tu-index=0 > %t/cas-tu.rsp
38+
39+
// RUN: cat %t/cas-tu.rsp | sed -E 's|.*"-fcas-include-tree" "(llvmcas://[[:xdigit:]]+)".*|\1|' > %t/tu.casid
40+
// RUN: clang-cas-test -cas %t/cas -print-include-tree @%t/tu.casid > %t/tu-include-tree.txt
41+
// RUN: FileCheck %s -input-file %t/tu-include-tree.txt -DPREFIX=%/t
42+
// CHECK: [[PREFIX]]/tu.m llvmcas://
43+
// CHECK-NEXT: 1:1 <built-in> llvmcas://
44+
// CHECK-NEXT: 2:1 (Module) Mod
45+
// CHECK-NEXT: 3:1 [[PREFIX]]/frameworks/FW.framework/Headers/Sub.h llvmcas://{{.*}}
46+
// CHECK-NEXT: Submodule: FW
47+
48+
// RUN: %clang @%t/cas-FW.cc1.rsp
49+
// RUN: %clang @%t/cas-Mod.cc1.rsp
50+
// RUN: %clang @%t/cas-tu.rsp

0 commit comments

Comments
 (0)