Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / ClangScanDeps / modules-symlink-dir-vfs.c
blobbc384b015e6f90b3760b6260e4c23d283b712546
1 // This test checks that we're not canonicalizing framework directories that
2 // play a role in VFS remapping. This could lead header search to fail when
3 // building that module.
5 // RUN: rm -rf %t
6 // RUN: split-file %s %t
8 // REQUIRES: shell
10 // RUN: mkdir -p %t/frameworks-symlink
11 // RUN: ln -s %t/frameworks/FW.framework %t/frameworks-symlink/FW.framework
13 // RUN: mkdir -p %t/copy
14 // RUN: cp %t/frameworks/FW.framework/Headers/FW.h %t/copy
15 // RUN: cp %t/frameworks/FW.framework/Headers/Header.h %t/copy
17 //--- frameworks/FW.framework/Modules/module.modulemap
18 framework module FW { umbrella header "FW.h" }
19 //--- frameworks/FW.framework/Headers/FW.h
20 #import <FW/Header.h>
21 //--- frameworks/FW.framework/Headers/Header.h
22 // empty
24 //--- tu.m
25 @import FW;
27 //--- overlay.json.template
29 "version": 0,
30 "case-sensitive": "false",
31 "roots": [
33 "contents": [
35 "external-contents": "DIR/copy/Header.h",
36 "name": "Header.h",
37 "type": "file"
40 "external-contents": "DIR/copy/FW.h",
41 "name": "FW.h",
42 "type": "file"
45 "name": "DIR/frameworks-symlink/FW.framework/Headers",
46 "type": "directory"
51 //--- cdb.json.template
53 "directory": "DIR",
54 "file": "DIR/tu.m",
55 "command": "clang -fmodules -fmodules-cache-path=DIR/cache -ivfsoverlay DIR/overlay.json -F DIR/frameworks-symlink -c DIR/tu.m -o DIR/tu.o -Werror=non-modular-include-in-framework-module"
58 // RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json
59 // RUN: sed -e "s|DIR|%/t|g" %t/overlay.json.template > %t/overlay.json
61 // RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full > %t/result.json
62 // RUN: cat %t/result.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t
64 // CHECK: {
65 // CHECK-NEXT: "modules": [
66 // CHECK-NEXT: {
67 // CHECK-NEXT: "clang-module-deps": [],
68 // CHECK-NEXT: "clang-modulemap-file": "[[PREFIX]]/frameworks-symlink/FW.framework/Modules/module.modulemap",
69 // CHECK-NEXT: "command-line": [
70 // CHECK-NEXT: "-cc1",
71 // CHECK: "-emit-module",
72 // CHECK-NEXT: "-x",
73 // CHECK-NEXT: "objective-c",
74 // CHECK-NEXT: "[[PREFIX]]/frameworks-symlink/FW.framework/Modules/module.modulemap",
75 // CHECK: ],
76 // CHECK-NEXT: "context-hash": "{{.*}}",
77 // CHECK-NEXT: "file-deps": [
78 // CHECK-NEXT: "[[PREFIX]]/copy/FW.h",
79 // CHECK-NEXT: "[[PREFIX]]/copy/Header.h",
80 // CHECK-NEXT: "[[PREFIX]]/frameworks-symlink/FW.framework/Modules/module.modulemap"
81 // CHECK-NEXT: ],
82 // CHECK-NEXT: "name": "FW"
83 // CHECK-NEXT: }
84 // CHECK-NEXT: ],
85 // CHECK-NEXT: "translation-units": [
86 // CHECK: ]
87 // CHECK: }
89 // RUN: %deps-to-rsp %t/result.json --module-name=FW > %t/FW.cc1.rsp
90 // RUN: %clang @%t/FW.cc1.rsp