File: add-remove-irrelevant-module-map.m

package info (click to toggle)
llvm-toolchain-15 1%3A15.0.6-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,554,644 kB
  • sloc: cpp: 5,922,452; ansic: 1,012,136; asm: 674,362; python: 191,568; objc: 73,855; f90: 42,327; lisp: 31,913; pascal: 11,973; javascript: 10,144; sh: 9,421; perl: 7,447; ml: 5,527; awk: 3,523; makefile: 2,520; xml: 885; cs: 573; fortran: 567
file content (58 lines) | stat: -rw-r--r-- 1,909 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// RUN: rm -rf %t && mkdir %t
// RUN: split-file %s %t

//--- a.modulemap
module a {}

//--- b.modulemap
module b {}

//--- test-simple.m
// expected-no-diagnostics
@import a;

// Build without b.modulemap:
//
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/cache -fdisable-module-hash \
// RUN:   -fmodule-map-file=%t/a.modulemap %t/test-simple.m -verify
// RUN: mv %t/cache %t/cache-without-b

// Build with b.modulemap:
//
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/cache -fdisable-module-hash \
// RUN:   -fmodule-map-file=%t/a.modulemap -fmodule-map-file=%t/b.modulemap %t/test-simple.m -verify
// RUN: mv %t/cache %t/cache-with-b

// Neither PCM file considers 'b.modulemap' an input:
//
// RUN: %clang_cc1 -module-file-info %t/cache-without-b/a.pcm | FileCheck %s --check-prefix=CHECK-B
// RUN: %clang_cc1 -module-file-info %t/cache-with-b/a.pcm | FileCheck %s --check-prefix=CHECK-B
// CHECK-B-NOT: Input file: {{.*}}b.modulemap

//--- c.modulemap
module c [no_undeclared_includes] { header "c.h" }

//--- c.h
#if __has_include("d.h") // This should use 'd.modulemap' in order to determine that 'd.h'
                         // doesn't exist for 'c' because of its '[no_undeclared_includes]'.
#endif

//--- d.modulemap
module d { header "d.h" }

//--- d.h
// empty

//--- test-no-undeclared-includes.m
// expected-no-diagnostics
@import c;

// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t/cache -fdisable-module-hash \
// RUN:   -fmodule-map-file=%t/c.modulemap -fmodule-map-file=%t/d.modulemap \
// RUN:   %t/test-no-undeclared-includes.m -verify

// The PCM file considers 'd.modulemap' an input because it affects the compilation,
// although it doesn't describe the built module or its imports.
//
// RUN: %clang_cc1 -module-file-info %t/cache/c.pcm | FileCheck %s --check-prefix=CHECK-D
// CHECK-D: Input file: {{.*}}d.modulemap