[flang][cuda] Adapt ExternalNameConversion to work in gpu module (#117039)
[llvm-project.git] / clang / test / ClangScanDeps / modules-pch-common-submodule.c
blob59dd3f172d8ee531fd0261e9f5b3fb7dc0aa8c61
1 // Unsupported on AIX because we don't support the requisite "__clangast"
2 // section in XCOFF yet.
3 // UNSUPPORTED: target={{.*}}-aix{{.*}}
5 // Check that when depending on a precompiled module, we depend on the
6 // **top-level** module. Submodules don't have some information present (for
7 // example the path to the modulemap file) and depending on them might cause
8 // problems in the dependency scanner (e.g. generating empty `-fmodule-map-file=`
9 // arguments).
11 // RUN: rm -rf %t && mkdir %t
12 // RUN: cp %S/Inputs/modules-pch-common-submodule/* %t
14 // Scan dependencies of the PCH:
16 // RUN: sed "s|DIR|%/t|g" %S/Inputs/modules-pch-common-submodule/cdb_pch.json > %t/cdb.json
17 // RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full \
18 // RUN: -module-files-dir %t/build > %t/result_pch.json
19 // RUN: cat %t/result_pch.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t -check-prefix=CHECK-PCH
21 // CHECK-PCH: {
22 // CHECK-PCH-NEXT: "modules": [
23 // CHECK-PCH-NEXT: {
24 // CHECK-PCH-NEXT: "clang-module-deps": [],
25 // CHECK-PCH-NEXT: "clang-modulemap-file": "[[PREFIX]]/module.modulemap",
26 // CHECK-PCH-NEXT: "command-line": [
27 // CHECK-PCH: ],
28 // CHECK-PCH-NEXT: "context-hash": "[[HASH_MOD_COMMON:.*]]",
29 // CHECK-PCH-NEXT: "file-deps": [
30 // CHECK-PCH-NEXT: "[[PREFIX]]/module.modulemap",
31 // CHECK-PCH-NEXT: "[[PREFIX]]/mod_common.h",
32 // CHECK-PCH-NEXT: "[[PREFIX]]/mod_common_sub.h"
33 // CHECK-PCH-NEXT: ],
34 // CHECK-PCH-NEXT: "link-libraries": [],
35 // CHECK-PCH-NEXT: "name": "ModCommon"
36 // CHECK-PCH-NEXT: }
37 // CHECK-PCH-NEXT: ],
38 // CHECK-PCH-NEXT: "translation-units": [
39 // CHECK-PCH-NEXT: {
40 // CHECK-PCH: "clang-context-hash": "[[HASH_PCH:.*]]",
41 // CHECK-PCH-NEXT: "clang-module-deps": [
42 // CHECK-PCH-NEXT: {
43 // CHECK-PCH-NEXT: "context-hash": "[[HASH_MOD_COMMON]]",
44 // CHECK-PCH-NEXT: "module-name": "ModCommon"
45 // CHECK-PCH-NEXT: }
46 // CHECK-PCH-NEXT: ],
47 // CHECK-PCH-NEXT: "command-line": [
48 // CHECK-PCH: ],
49 // CHECK-PCH: "file-deps": [
50 // CHECK-PCH-NEXT: "[[PREFIX]]/pch.h"
51 // CHECK-PCH-NEXT: ],
52 // CHECK-PCH-NEXT: "input-file": "[[PREFIX]]/pch.h"
53 // CHECK-PCH-NEXT: }
55 // Explicitly build the PCH:
57 // RUN: %deps-to-rsp %t/result_pch.json --module-name=ModCommon > %t/mod_common.cc1.rsp
58 // RUN: %deps-to-rsp %t/result_pch.json --tu-index=0 > %t/pch.rsp
60 // RUN: %clang @%t/mod_common.cc1.rsp
61 // RUN: %clang @%t/pch.rsp
63 // Scan dependencies of the TU:
65 // RUN: sed "s|DIR|%/t|g" %S/Inputs/modules-pch-common-submodule/cdb_tu.json > %t/cdb.json
66 // RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full \
67 // RUN: -module-files-dir %t/build > %t/result_tu.json
68 // RUN: cat %t/result_tu.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t -check-prefix=CHECK-TU
70 // CHECK-TU: {
71 // CHECK-TU-NEXT: "modules": [
72 // CHECK-TU-NEXT: {
73 // CHECK-TU-NEXT: "clang-module-deps": [],
74 // CHECK-TU-NEXT: "clang-modulemap-file": "[[PREFIX]]/module.modulemap",
75 // CHECK-TU-NEXT: "command-line": [
76 // CHECK-TU: ],
77 // CHECK-TU-NEXT: "context-hash": "[[HASH_MOD_TU:.*]]",
78 // CHECK-TU-NEXT: "file-deps": [
79 // CHECK-TU-NEXT: "[[PREFIX]]/module.modulemap",
80 // CHECK-TU-NEXT: "[[PREFIX]]/mod_tu.h"
81 // CHECK-TU-NEXT: ],
82 // CHECK-TU-NEXT: "link-libraries": [],
83 // CHECK-TU-NEXT: "name": "ModTU"
84 // CHECK-TU-NEXT: }
85 // CHECK-TU-NEXT: ],
86 // CHECK-TU-NEXT: "translation-units": [
87 // CHECK-TU-NEXT: {
88 // CHECK-TU: "clang-context-hash": "[[HASH_TU:.*]]",
89 // CHECK-TU-NEXT: "clang-module-deps": [
90 // CHECK-TU-NEXT: {
91 // CHECK-TU-NEXT: "context-hash": "[[HASH_MOD_TU]]"
92 // CHECK-TU-NEXT: "module-name": "ModTU"
93 // CHECK-TU-NEXT: }
94 // CHECK-TU-NEXT: ],
95 // CHECK-TU-NEXT: "command-line": [
96 // CHECK-TU: ],
97 // CHECK-TU: "file-deps": [
98 // CHECK-TU-NEXT: "[[PREFIX]]/tu.c",
99 // CHECK-TU-NEXT: "[[PREFIX]]/pch.h.pch"
100 // CHECK-TU-NEXT: ],
101 // CHECK-TU-NEXT: "input-file": "[[PREFIX]]/tu.c"
102 // CHECK-TU-NEXT: }
104 // Explicitly build the TU:
106 // RUN: %deps-to-rsp %t/result_tu.json --module-name=ModTU > %t/mod_tu.cc1.rsp
107 // RUN: %deps-to-rsp %t/result_tu.json --tu-index=0 > %t/tu.rsp
109 // RUN: %clang @%t/mod_tu.cc1.rsp
110 // RUN: %clang @%t/tu.rsp