[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / ClangScanDeps / removed-args.c
blob02fbb8cacff2cb2c75978fbb87047e6d36c463d5
1 // Some command-line arguments used for compiling translation units are not
2 // compatible with the semantics of modules or are likely to differ between
3 // identical modules discovered from different translation units. This test
4 // checks such arguments are removed from the command-lines: '-include',
5 // '-dwarf-debug-flag' and '-main-file-name'. Similarly, several arguments
6 // such as '-fmodules-cache-path=' are only relevant for implicit modules, and
7 // are removed to better-canonicalize the compilation.
9 // RUN: rm -rf %t && mkdir %t
10 // RUN: cp %S/Inputs/removed-args/* %t
11 // RUN: touch %t/build-session
13 // RUN: sed "s|DIR|%/t|g" %S/Inputs/removed-args/cdb.json.template > %t/cdb.json
14 // RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full > %t/result.json
15 // RUN: cat %t/result.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t
17 // CHECK: {
18 // CHECK-NEXT: "modules": [
19 // CHECK-NEXT: {
20 // CHECK-NEXT: "clang-module-deps": [],
21 // CHECK-NEXT: "clang-modulemap-file": "[[PREFIX]]/module.modulemap",
22 // CHECK-NEXT: "command-line": [
23 // CHECK-NEXT: "-cc1"
24 // CHECK-NOT: "-fdebug-compilation-dir="
25 // CHECK-NOT: "-fcoverage-compilation-dir="
26 // CHECK-NOT: "-dwarf-debug-flags"
27 // CHECK-NOT: "-main-file-name"
28 // CHECK-NOT: "-include"
29 // CHECK-NOT: "-fmodules-cache-path=
30 // CHECK-NOT: "-fmodules-validate-once-per-build-session"
31 // CHECK-NOT: "-fbuild-session-timestamp=
32 // CHECK-NOT: "-fmodules-prune-interval=
33 // CHECK-NOT: "-fmodules-prune-after=
34 // CHECK: ],
35 // CHECK-NEXT: "context-hash": "[[HASH_MOD_HEADER:.*]]",
36 // CHECK-NEXT: "file-deps": [
37 // CHECK-NEXT: "[[PREFIX]]/mod_header.h",
38 // CHECK-NEXT: "[[PREFIX]]/module.modulemap"
39 // CHECK-NEXT: ],
40 // CHECK-NEXT: "name": "ModHeader"
41 // CHECK-NEXT: },
42 // CHECK-NEXT: {
43 // CHECK-NEXT: "clang-module-deps": [],
44 // CHECK-NEXT: "clang-modulemap-file": "[[PREFIX]]/module.modulemap",
45 // CHECK-NEXT: "command-line": [
46 // CHECK-NEXT: "-cc1"
47 // CHECK-NOT: "-fdebug-compilation-dir=
48 // CHECK-NOT: "-fcoverage-compilation-dir=
49 // CHECK-NOT: "-dwarf-debug-flags"
50 // CHECK-NOT: "-main-file-name"
51 // CHECK-NOT: "-include"
52 // CHECK-NOT: "-fmodules-cache-path=
53 // CHECK-NOT: "-fmodules-validate-once-per-build-session"
54 // CHECK-NOT: "-fbuild-session-timestamp=
55 // CHECK-NOT: "-fmodules-prune-interval=
56 // CHECK-NOT: "-fmodules-prune-after=
57 // CHECK: ],
58 // CHECK-NEXT: "context-hash": "[[HASH_MOD_TU:.*]]",
59 // CHECK-NEXT: "file-deps": [
60 // CHECK-NEXT: "[[PREFIX]]/mod_tu.h",
61 // CHECK-NEXT: "[[PREFIX]]/module.modulemap"
62 // CHECK-NEXT: ],
63 // CHECK-NEXT: "name": "ModTU"
64 // CHECK-NEXT: }
65 // CHECK-NEXT: ],
66 // CHECK-NEXT: "translation-units": [
67 // CHECK-NEXT: {
68 // CHECK: "clang-context-hash": "[[HASH_TU:.*]]",
69 // CHECK-NEXT: "clang-module-deps": [
70 // CHECK-NEXT: {
71 // CHECK-NEXT: "context-hash": "[[HASH_MOD_HEADER]]",
72 // CHECK-NEXT: "module-name": "ModHeader"
73 // CHECK-NEXT: },
74 // CHECK-NEXT: {
75 // CHECK-NEXT: "context-hash": "[[HASH_MOD_TU]]",
76 // CHECK-NEXT: "module-name": "ModTU"
77 // CHECK-NEXT: }
78 // CHECK-NEXT: ]
79 // CHECK-NEXT: "command-line": [
80 // CHECK-NEXT: "-cc1",
81 // CHECK-NOT: "-fmodules-cache-path=
82 // CHECK-NOT: "-fmodules-validate-once-per-build-session"
83 // CHECK-NOT: "-fbuild-session-timestamp=
84 // CHECK-NOT: "-fbuild-session-file=
85 // CHECK-NOT: "-fmodules-prune-interval=
86 // CHECK-NOT: "-fmodules-prune-after=
87 // CHECK: ],