1 // This test checks that modules loaded during compilation (but not imported)
2 // are still reported as dependencies.
4 // RUN: rm -rf %t && mkdir %t
5 // RUN: split-file %s %t
7 //--- frameworks/FW.framework/Modules/module.modulemap
8 framework module FW { umbrella header "FW.h" }
9 //--- frameworks/FW.framework/Headers/FW.h
10 //--- frameworks/FW.framework/Modules/module.private.modulemap
11 framework module FW_Private { umbrella header "FW_Private.h" }
12 //--- frameworks/FW.framework/PrivateHeaders/FW_Private.h
14 //--- cdb.json.template
18 "command": "clang -fmodules -fmodules-cache-path=DIR/cache -F DIR/frameworks -c DIR/tu.m -o DIR/tu.o"
23 // RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json
24 // RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full > %t/result.json
25 // RUN: cat %t/result.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t
27 // CHECK-NEXT: "modules": [
29 // CHECK: "clang-module-deps": [],
30 // CHECK-NEXT: "clang-modulemap-file": "[[PREFIX]]/frameworks/FW.framework/Modules/module.modulemap",
31 // CHECK-NEXT: "command-line": [
33 // CHECK-NEXT: "context-hash": "{{.*}}",
34 // CHECK: "file-deps": [
35 // CHECK-NEXT: "[[PREFIX]]/frameworks/FW.framework/Headers/FW.h",
36 // CHECK-NEXT: "[[PREFIX]]/frameworks/FW.framework/Modules/module.modulemap"
38 // CHECK-NEXT: "name": "FW"
41 // CHECK: "clang-module-deps": [],
42 // CHECK-NEXT: "clang-modulemap-file": "[[PREFIX]]/frameworks/FW.framework/Modules/module.private.modulemap",
43 // CHECK-NEXT: "command-line": [
45 // CHECK-NEXT: "context-hash": "{{.*}}",
46 // CHECK: "file-deps": [
47 // CHECK-NEXT: "[[PREFIX]]/frameworks/FW.framework/Modules/module.private.modulemap",
48 // CHECK-NEXT: "[[PREFIX]]/frameworks/FW.framework/PrivateHeaders/FW_Private.h"
50 // CHECK-NEXT: "name": "FW_Private"
53 // CHECK-NEXT: "translation-units": [
55 // CHECK: "clang-context-hash": "{{.*}}",
56 // CHECK-NEXT: "clang-module-deps": [
58 // CHECK-NEXT: "context-hash": "{{.*}}",
59 // CHECK-NEXT: "module-name": "FW"
62 // CHECK-NEXT: "context-hash": "{{.*}}",
63 // CHECK-NEXT: "module-name": "FW_Private"
66 // CHECK-NEXT: "command-line": [
67 // CHECK: "-fmodule-file={{.*}}/FW-{{.*}}.pcm"
68 // CHECK: "-fmodule-file={{.*}}/FW_Private-{{.*}}.pcm"
70 // CHECK: "file-deps": [
71 // CHECK-NEXT: "[[PREFIX]]/tu.m"
73 // CHECK-NEXT: "input-file": "[[PREFIX]]/tu.m"
76 // RUN: %deps-to-rsp %t/result.json --module-name=FW > %t/FW.cc1.rsp
77 // RUN: %deps-to-rsp %t/result.json --module-name=FW_Private > %t/FW_Private.cc1.rsp
78 // RUN: %deps-to-rsp %t/result.json --tu-index=0 > %t/tu.rsp
79 // RUN: %clang @%t/FW.cc1.rsp
80 // RUN: %clang @%t/FW_Private.cc1.rsp
81 // RUN: %clang @%t/tu.rsp