[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / ClangScanDeps / modules-symlink-dir-from-module.c
blob5f0ebc13eb2ee96619330ac9656ee6a53b4e4866
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.
6 // REQUIRES: shell
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
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
17 // RUN: cat %t/deps.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t
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: }
28 //--- cdb.json.in
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"
35 //--- include/module/module.modulemap
36 module Mod { header "mod.h" export * }
38 //--- include/module/mod.h
40 //--- include/module.modulemap
41 module Other { header "other.h" export * }
43 //--- include/other.h
44 #include "symlink-to-module/mod.h"
45 #include "module/mod.h"
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 * }
52 //--- Frameworks/Foo.framework/Headers/Foo.h
53 #include "module/mod.h"
55 //--- Frameworks/Foo.framework/PrivateHeaders/Priv.h
56 #include <Foo/Foo.h>
57 #include "other.h"
59 //--- module.modulemap
60 module Test { header "test.h" export * }
62 //--- test.h
63 #include <Foo/Priv.h>
64 #include <Foo/Foo.h>
66 //--- test.c
67 #include "test.h"