1 // This test checks that __has_include(<FW/PrivateHeader.h>) in a module does
2 // not clobber #include <FW/PrivateHeader.h> in importers of said module.
5 // RUN: split-file %s %t
7 //--- cdb.json.template
11 "command": "clang DIR/tu.c -fmodules -fmodules-cache-path=DIR/cache -I DIR/modules -F DIR/frameworks -o DIR/tu.o"
14 //--- frameworks/FW.framework/Modules/module.private.modulemap
15 framework module FW_Private
{
19 //--- frameworks/FW.framework/PrivateHeaders/A.h
21 //--- frameworks/FW.framework/PrivateHeaders/B.h
22 #include "dependency.h"
24 //--- modules/module.modulemap
25 module Poison
{ header
"poison.h" }
26 module Import
{ header
"import.h" }
27 module Dependency
{ header
"dependency.h" }
28 //--- modules/poison.h
29 #if __has_include(<FW/B.h>)
34 //--- modules/import.h
36 //--- modules/dependency.h
41 #if __has_include(<FW/B.h>)
48 // RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json
49 // RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full > %t/deps.json
50 // RUN: cat %t/deps.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t
52 // Let's check that the TU actually depends on `FW_Private` (and does not treat FW/B.h as textual).
54 // CHECK: "translation-units": [
56 // CHECK-NEXT: "commands": [
58 // CHECK-NEXT: "clang-context-hash": "{{.*}}",
59 // CHECK-NEXT: "clang-module-deps": [
61 // CHECK-NEXT: "context-hash": "{{.*}}",
62 // CHECK-NEXT: "module-name": "FW_Private"
65 // CHECK-NEXT: "command-line": [
67 // CHECK: "file-deps": [
68 // CHECK-NEXT: "[[PREFIX]]/tu.c"
70 // CHECK-NEXT: "input-file": "[[PREFIX]]/tu.c"