[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / clang / test / ClangScanDeps / modules-implicit-dot-private.m
blob20b988d15de32f81d96e706ef9f9f8c610658fb4
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
16   "file": "DIR/tu.m",
17   "directory": "DIR",
18   "command": "clang -fmodules -fmodules-cache-path=DIR/cache -F DIR/frameworks -c DIR/tu.m -o DIR/tu.o"
20 //--- tu.m
21 @import FW.Private;
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
26 // CHECK:      {
27 // CHECK-NEXT:   "modules": [
28 // CHECK-NEXT:     {
29 // CHECK:            "clang-module-deps": [],
30 // CHECK-NEXT:       "clang-modulemap-file": "[[PREFIX]]/frameworks/FW.framework/Modules/module.modulemap",
31 // CHECK-NEXT:       "command-line": [
32 // CHECK:            ],
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"
37 // CHECK-NEXT:       ],
38 // CHECK-NEXT:       "name": "FW"
39 // CHECK:          },
40 // CHECK:          {
41 // CHECK:            "clang-module-deps": [],
42 // CHECK-NEXT:       "clang-modulemap-file": "[[PREFIX]]/frameworks/FW.framework/Modules/module.private.modulemap",
43 // CHECK-NEXT:       "command-line": [
44 // CHECK:            ],
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"
49 // CHECK-NEXT:       ],
50 // CHECK-NEXT:       "name": "FW_Private"
51 // CHECK:           }
52 // CHECK:        ],
53 // CHECK-NEXT:   "translation-units": [
54 // CHECK-NEXT:     {
55 // CHECK:            "clang-context-hash": "{{.*}}",
56 // CHECK-NEXT:       "clang-module-deps": [
57 // CHECK-NEXT:         {
58 // CHECK-NEXT:           "context-hash": "{{.*}}",
59 // CHECK-NEXT:           "module-name": "FW"
60 // CHECK-NEXT:         },
61 // CHECK-NEXT:         {
62 // CHECK-NEXT:           "context-hash": "{{.*}}",
63 // CHECK-NEXT:           "module-name": "FW_Private"
64 // CHECK-NEXT:         }
65 // CHECK-NEXT:       ],
66 // CHECK-NEXT:       "command-line": [
67 // CHECK:              "-fmodule-file={{.*}}/FW-{{.*}}.pcm"
68 // CHECK:              "-fmodule-file={{.*}}/FW_Private-{{.*}}.pcm"
69 // CHECK:            ],
70 // CHECK:            "file-deps": [
71 // CHECK-NEXT:         "[[PREFIX]]/tu.m"
72 // CHECK-NEXT:       ],
73 // CHECK-NEXT:       "input-file": "[[PREFIX]]/tu.m"
74 // CHECK-NEXT:     }
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