[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / clang / test / ClangScanDeps / modules-implementation-private.m
blob6a9d83c22678bf7e8919d287df3bea6593aac4c9
1 // This test checks that we don't crash or report spurious dependencies on
2 // FW_Private when compiling the implementation of framework module FW.
4 // RUN: rm -rf %t
5 // RUN: split-file %s %t
7 //--- cdb.json.template
8 [{
9   "directory": "DIR",
10   "file": "DIR/tu.m",
11   "command": "clang -fmodules -fmodules-cache-path=DIR/cache -fmodule-name=FW -F DIR/frameworks -c DIR/tu.m -o DIR/tu.o"
14 //--- frameworks/FW.framework/Modules/module.modulemap
15 framework module FW { umbrella header "FW.h" }
16 //--- frameworks/FW.framework/Modules/module.private.modulemap
17 framework module FW_Private { umbrella header "FW_Private.h" }
18 //--- frameworks/FW.framework/Headers/FW.h
19 //--- frameworks/FW.framework/PrivateHeaders/FW_Private.h
20 //--- frameworks/FW.framework/PrivateHeaders/Missed.h
21 #import <FW/FW.h> // When included from tu.m, this ends up adding (spurious) dependency on FW for FW_Private.
23 //--- tu.m
24 @import FW_Private; // This is a direct dependency.
25 #import <FW/Missed.h>
27 // RUN: sed "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json
28 // RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full > %t/result.json
29 // RUN: cat %t/result.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t
31 // CHECK:      {
32 // CHECK-NEXT:   "modules": [
33 // CHECK-NEXT:     {
34 // CHECK-NEXT:       "clang-module-deps": [],
35 // CHECK-NEXT:       "clang-modulemap-file": "[[PREFIX]]/frameworks/FW.framework/Modules/module.private.modulemap",
36 // CHECK-NEXT:       "command-line": [
37 // CHECK:            ],
38 // CHECK-NEXT:       "context-hash": "{{.*}}",
39 // CHECK-NEXT:       "file-deps": [
40 // CHECK-NEXT:         "[[PREFIX]]/frameworks/FW.framework/Modules/module.private.modulemap",
41 // CHECK-NEXT:         "[[PREFIX]]/frameworks/FW.framework/PrivateHeaders/FW_Private.h"
42 // CHECK-NEXT:       ],
43 // CHECK-NEXT:       "name": "FW_Private"
44 // CHECK-NEXT:     }
45 // CHECK-NEXT:   ],
46 // CHECK-NEXT:   "translation-units": [
47 // CHECK-NEXT:     {
48 // CHECK-NEXT:       "commands": [
49 // CHECK-NEXT:         {
50 // CHECK-NEXT:           "clang-context-hash": "{{.*}}",
51 // CHECK-NEXT:           "clang-module-deps": [
52 // CHECK-NEXT:             {
53 // CHECK-NEXT:               "context-hash": "{{.*}}",
54 // CHECK-NEXT:               "module-name": "FW_Private"
55 // CHECK-NEXT:             }
56 // CHECK-NEXT:           ],
57 // CHECK-NEXT:           "command-line": [
58 // CHECK:                ],
59 // CHECK-NEXT:           "executable": "clang",
60 // CHECK-NEXT:           "file-deps": [
61 // CHECK-NEXT:             "[[PREFIX]]/tu.m",
62 // CHECK-NEXT:             "[[PREFIX]]/frameworks/FW.framework/PrivateHeaders/Missed.h",
63 // CHECK-NEXT:             "[[PREFIX]]/frameworks/FW.framework/Headers/FW.h"
64 // CHECK-NEXT:           ],
65 // CHECK-NEXT:           "input-file": "[[PREFIX]]/tu.m"
66 // CHECK-NEXT:         }
67 // CHECK:            ]
68 // CHECK:          }
69 // CHECK:        ]
70 // CHECK:      }