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.
5 // RUN: split-file %s %t
7 //--- cdb.json.template
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.
24 @import FW_Private; // This is a direct dependency.
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
32 // CHECK-NEXT: "modules": [
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": [
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"
43 // CHECK-NEXT: "link-libraries": [
45 // CHECK-NEXT: "isFramework": true,
46 // CHECK-NEXT: "link-name": "FW"
49 // CHECK-NEXT: "name": "FW_Private"
52 // CHECK-NEXT: "translation-units": [
54 // CHECK-NEXT: "commands": [
56 // CHECK-NEXT: "clang-context-hash": "{{.*}}",
57 // CHECK-NEXT: "clang-module-deps": [
59 // CHECK-NEXT: "context-hash": "{{.*}}",
60 // CHECK-NEXT: "module-name": "FW_Private"
63 // CHECK-NEXT: "command-line": [
65 // CHECK: "file-deps": [
66 // CHECK-NEXT: "[[PREFIX]]/tu.m",
67 // CHECK-NEXT: "[[PREFIX]]/frameworks/FW.framework/PrivateHeaders/Missed.h",
68 // CHECK-NEXT: "[[PREFIX]]/frameworks/FW.framework/Headers/FW.h"
70 // CHECK-NEXT: "input-file": "[[PREFIX]]/tu.m"