brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.9 KiB · 85f5f1a Raw
68 lines · c
1// Check that the path of an imported modulemap file is not influenced by2// modules outside that module's dependency graph. Specifically, the "Foo"3// module below does not transitively import Mod via a symlink, so it should not4// see the symlinked path.5 6// REQUIRES: symlinks7 8// RUN: rm -rf %t9// RUN: split-file %s %t10// RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.in > %t/cdb.json11// RUN: ln -s module %t/include/symlink-to-module12 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.json16 17// RUN: cat %t/deps.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t18 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.in29[{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.modulemap36module Mod { header "mod.h" export * }37 38//--- include/module/mod.h39 40//--- include/module.modulemap41module Other { header "other.h" export * }42 43//--- include/other.h44#include "symlink-to-module/mod.h"45#include "module/mod.h"46 47//--- Frameworks/Foo.framework/Modules/module.modulemap48framework module Foo { header "Foo.h" export * }49//--- Frameworks/Foo.framework/Modules/module.private.modulemap50framework module Foo_Private { header "Priv.h" export * }51 52//--- Frameworks/Foo.framework/Headers/Foo.h53#include "module/mod.h"54 55//--- Frameworks/Foo.framework/PrivateHeaders/Priv.h56#include <Foo/Foo.h>57#include "other.h"58 59//--- module.modulemap60module Test { header "test.h" export * }61 62//--- test.h63#include <Foo/Priv.h>64#include <Foo/Foo.h>65 66//--- test.c67#include "test.h"68