1 // Check that we canonicalize the module map path without changing the module
2 // directory, which would break header lookup.
7 // RUN: split-file %s %t
8 // RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.in > %t/cdb.json
9 // RUN: ln -s module %t/symlink-to-module
10 // RUN: ln -s ../actual.modulemap %t/module/module.modulemap
11 // RUN: ln -s A %t/module/F.framework/Versions/Current
12 // RUN: ln -s Versions/Current/Modules %t/module/F.framework/Modules
13 // RUN: ln -s Versions/Current/Headers %t/module/F.framework/Headers
15 // RUN: clang-scan-deps -compilation-database %t/cdb.json -j 1 \
16 // RUN: -format experimental-full -mode=preprocess-dependency-directives \
17 // RUN: -optimize-args -module-files-dir %t/build > %t/deps.json
19 // RUN: cat %t/deps.json | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t %s
21 // Check the module commands actually build.
22 // RUN: %deps-to-rsp %t/deps.json --module-name=Mod > %t/Mod.rsp
23 // RUN: %deps-to-rsp %t/deps.json --module-name=F > %t/F.rsp
24 // RUN: %clang @%t/Mod.rsp
25 // RUN: %clang @%t/F.rsp
27 // CHECK: "modules": [
29 // CHECK: "clang-module-deps": [],
30 // CHECK: "clang-modulemap-file": "[[PREFIX]]/module/F.framework/Modules/module.modulemap"
31 // CHECK: "command-line": [
32 // CHECK-NOT: symlink-to-module
33 // CHECK: "[[PREFIX]]/module/F.framework/Modules/module.modulemap"
34 // CHECK-NOT: symlink-to-module
36 // CHECK: "context-hash": "[[F_CONTEXT_HASH:[A-Z0-9]+]]"
40 // CHECK: "clang-modulemap-file": "[[PREFIX]]/module/module.modulemap"
41 // CHECK: "command-line": [
42 // CHECK-NOT: symlink-to-module
43 // CHECK: "[[PREFIX]]/module/module.modulemap"
44 // CHECK-NOT: symlink-to-module
46 // CHECK: "context-hash": "[[CONTEXT_HASH:[A-Z0-9]+]]"
47 // CHECK: "name": "Mod"
50 // CHECK: "translation-units": [
51 // CHECK: "clang-module-deps": [
53 // CHECK: "context-hash": "[[CONTEXT_HASH]]"
54 // CHECK: "module-name": "Mod"
57 // CHECK: "command-line": [
58 // CHECK: "-fmodule-map-file=[[PREFIX]]/module/module.modulemap"
60 // CHECK: "clang-module-deps": [
62 // CHECK: "context-hash": "[[CONTEXT_HASH]]"
63 // CHECK: "module-name": "Mod"
66 // CHECK: "command-line": [
67 // CHECK: "-fmodule-map-file=[[PREFIX]]/module/module.modulemap"
69 // CHECK: "clang-module-deps": [
71 // CHECK: "context-hash": "[[F_CONTEXT_HASH]]"
72 // CHECK: "module-name": "F"
75 // CHECK: "command-line": [
76 // CHECK: "-fmodule-map-file=[[PREFIX]]/module/F.framework/Modules/module.modulemap"
78 // CHECK: "clang-module-deps": [
80 // CHECK: "context-hash": "[[F_CONTEXT_HASH]]"
81 // CHECK: "module-name": "F"
84 // CHECK: "command-line": [
85 // CHECK: "-fmodule-map-file=[[PREFIX]]/module/F.framework/Modules/module.modulemap"
92 "command": "clang -fsyntax-only DIR/tu1.c -fmodules -fimplicit-module-maps -fmodules-cache-path=DIR/cache",
97 "command": "clang -fsyntax-only DIR/tu2.c -fmodules -fimplicit-module-maps -fmodules-cache-path=DIR/cache",
102 "command": "clang -fsyntax-only -F DIR/symlink-to-module DIR/tu3.c -fmodules -fimplicit-module-maps -fmodules-cache-path=DIR/cache",
107 "command": "clang -fsyntax-only -F DIR/module DIR/tu3.c -fmodules -fimplicit-module-maps -fmodules-cache-path=DIR/cache",
112 //--- actual.modulemap
113 module Mod
{ header
"header.h" }
115 //--- module/header.h
118 #include "symlink-to-module/header.h"
121 #include "module/header.h"
123 //--- module/F.framework/Versions/A/Modules/module.modulemap
125 umbrella header
"F.h"
128 //--- module/F.framework/Versions/A/Headers/F.h