1 // Check that the path of an imported modulemap file is not influenced by 2 // modules outside that module's dependency graph. Specifically, the "Foo" 3 // module below does not transitively import Mod via a symlink, so it should not 4 // see the symlinked path. 5 6 // REQUIRES: shell 7 8 // RUN: rm -rf %t 9 // RUN: split-file %s %t 10 // RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.in > %t/cdb.json 11 // RUN: ln -s module %t/include/symlink-to-module 12 13 // RUN: clang-scan-deps -compilation-database %t/cdb.json -j 1 \ 14 // RUN: -format experimental-full -mode=preprocess-dependency-directives \ 15 // RUN: -optimize-args=all -module-files-dir %t/build > %t/deps.json 16 17 // RUN: cat %t/deps.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t 18 19 // CHECK: "modules": [ 20 // CHECK: { 21 // CHECK: "command-line": [ 22 // CHECK-NOT: ] 23 // CHECK: "-fmodule-map-file=[[PREFIX]]/include/module/module.modulemap" 24 // CHECK: ] 25 // CHECK: "name": "Foo" 26 // CHECK: } 27 28 //--- cdb.json.in 29 [{ 30 "directory": "DIR", 31 "command": "clang -fsyntax-only DIR/test.c -F DIR/Frameworks -I DIR/include -fmodules -fimplicit-module-maps -fmodules-cache-path=DIR/module-cache", 32 "file": "DIR/test.c" 33 }] 34 35 //--- include/module/module.modulemap 36 module Mod { header "mod.h" export * } 37 38 //--- include/module/mod.h 39 40 //--- include/module.modulemap 41 module Other { header "other.h" export * } 42 43 //--- include/other.h 44 #include "symlink-to-module/mod.h" 45 #include "module/mod.h" 46 47 //--- Frameworks/Foo.framework/Modules/module.modulemap 48 framework module Foo { header "Foo.h" export * } 49 //--- Frameworks/Foo.framework/Modules/module.private.modulemap 50 framework module Foo_Private { header "Priv.h" export * } 51 52 //--- Frameworks/Foo.framework/Headers/Foo.h 53 #include "module/mod.h" 54 55 //--- Frameworks/Foo.framework/PrivateHeaders/Priv.h 56 #include <Foo/Foo.h> 57 #include "other.h" 58 59 //--- module.modulemap 60 module Test { header "test.h" export * } 61 62 //--- test.h 63 #include <Foo/Priv.h> 64 #include <Foo/Foo.h> 65 66 //--- test.c 67 #include "test.h" 68