[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / ClangScanDeps / modules-dep-args.c
blob12bdb6eb1f7fd877b353cc6a91b0664bc2fbba05
1 // This test exercises the different ways explicit modular dependencies are
2 // provided on the command-line.
4 // RUN: rm -rf %t
5 // RUN: split-file %s %t
7 //--- cdb.json.template
8 [{
9 "file": "DIR/tu.c",
10 "directory": "DIR",
11 "command": "clang DIR/tu.c -fmodules -fmodules-cache-path=DIR/cache -o DIR/tu.o"
14 //--- module.modulemap
15 module Transitive { header "transitive.h" }
16 module Direct { header "direct.h" }
17 //--- transitive.h
18 //--- direct.h
19 #include "transitive.h"
20 //--- tu.c
21 #include "direct.h"
23 // RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json
25 // Check that the PCM path defaults to the modules cache from implicit build.
26 // RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full > %t/result_cache.json
27 // RUN: cat %t/result_cache.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t --check-prefixes=CHECK,CHECK_CACHE
29 // Check that the PCM path can be customized.
30 // RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full -module-files-dir %t/build > %t/result_build.json
31 // RUN: cat %t/result_build.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t --check-prefixes=CHECK,CHECK_BUILD
33 // Check that the PCM file is loaded lazily by default.
34 // RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full > %t/result_lazy.json
35 // RUN: cat %t/result_lazy.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t --check-prefixes=CHECK,CHECK_LAZY
37 // Check that the PCM file can be loaded eagerly.
38 // RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full -eager-load-pcm > %t/result_eager.json
39 // RUN: cat %t/result_eager.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t --check-prefixes=CHECK,CHECK_EAGER
41 // CHECK: {
42 // CHECK-NEXT: "modules": [
43 // CHECK-NEXT: {
44 // CHECK-NEXT: "clang-module-deps": [
45 // CHECK-NEXT: {
46 // CHECK-NEXT: "context-hash": "{{.*}}",
47 // CHECK-NEXT: "module-name": "Transitive"
48 // CHECK-NEXT: }
49 // CHECK-NEXT: ],
50 // CHECK-NEXT: "clang-modulemap-file": "[[PREFIX]]/module.modulemap",
51 // CHECK-NEXT: "command-line": [
52 // CHECK_CACHE: "-fmodule-file={{.*}}/cache/{{.*}}/Transitive-{{.*}}.pcm"
53 // CHECK_BUILD: "-fmodule-file={{.*}}/build/{{.*}}/Transitive-{{.*}}.pcm"
54 // CHECK_LAZY: "-fmodule-map-file=[[PREFIX]]/module.modulemap"
55 // CHECK_LAZY: "-fmodule-file=Transitive=[[PREFIX]]/{{.*}}/Transitive-{{.*}}.pcm"
56 // CHECK_EAGER-NOT: "-fmodule-map-file={{.*}}"
57 // CHECK_EAGER: "-fmodule-file=[[PREFIX]]/{{.*}}/Transitive-{{.*}}.pcm"
58 // CHECK: ],
59 // CHECK-NEXT: "context-hash": "{{.*}}",
60 // CHECK-NEXT: "file-deps": [
61 // CHECK-NEXT: "[[PREFIX]]/direct.h",
62 // CHECK-NEXT: "[[PREFIX]]/module.modulemap"
63 // CHECK-NEXT: ],
64 // CHECK-NEXT: "name": "Direct"
65 // CHECK-NEXT: },
66 // CHECK-NEXT: {
67 // CHECK-NEXT: "clang-module-deps": [],
68 // CHECK-NEXT: "clang-modulemap-file": "[[PREFIX]]/module.modulemap",
69 // CHECK-NEXT: "command-line": [
70 // CHECK: ],
71 // CHECK-NEXT: "context-hash": "{{.*}}",
72 // CHECK-NEXT: "file-deps": [
73 // CHECK-NEXT: "[[PREFIX]]/module.modulemap",
74 // CHECK-NEXT: "[[PREFIX]]/transitive.h"
75 // CHECK-NEXT: ],
76 // CHECK-NEXT: "name": "Transitive"
77 // CHECK-NEXT: }
78 // CHECK-NEXT: ],
79 // CHECK-NEXT: "translation-units": [
80 // CHECK-NEXT: {
81 // CHECK: "clang-context-hash": "{{.*}}",
82 // CHECK-NEXT: "clang-module-deps": [
83 // CHECK-NEXT: {
84 // CHECK-NEXT: "context-hash": "{{.*}}",
85 // CHECK-NEXT: "module-name": "Direct"
86 // CHECK-NEXT: }
87 // CHECK-NEXT: ],
88 // CHECK-NEXT: "command-line": [
89 // CHECK_CACHE: "-fmodule-file={{.*}}/cache/{{.*}}/Direct-{{.*}}.pcm"
90 // CHECK_BUILD: "-fmodule-file={{.*}}/build/{{.*}}/Direct-{{.*}}.pcm"
91 // CHECK_LAZY: "-fmodule-map-file=[[PREFIX]]/module.modulemap"
92 // CHECK_LAZY: "-fmodule-file=Direct=[[PREFIX]]/{{.*}}/Direct-{{.*}}.pcm"
93 // CHECK_EAGER-NOT: "-fmodule-map-file={{.*}}"
94 // CHECK_EAGER: "-fmodule-file=[[PREFIX]]/{{.*}}/Direct-{{.*}}.pcm"
95 // CHECK: ],
96 // CHECK: "file-deps": [
97 // CHECK-NEXT: "[[PREFIX]]/tu.c"
98 // CHECK-NEXT: ],
99 // CHECK-NEXT: "input-file": "[[PREFIX]]/tu.c"
100 // CHECK-NEXT: }