File: modules-outputs-c-api.c

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (93 lines) | stat: -rw-r--r-- 4,293 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
// RUN: rm -rf %t
// RUN: split-file %s %t

// RUN: c-index-test core -scan-deps -working-dir %t -output-dir %t/out -- \
// RUN:   clang_tool -c %t/tu.c -fmodules -fmodules-cache-path=%t/cache \
// RUN:   -fimplicit-modules -fimplicit-module-maps \
// RUN:   -serialize-diagnostics %t/tu.diag -MD -MF %t/tu.d -o %t/tu.o \
// RUN: | FileCheck %s -DPREFIX=%/t -check-prefix=NONE

// NONE:        build-args:
// NONE-NOT:      -MT
// NONE-NOT:      -serialize-diagnostics-file
// NONE-NOT:      -dependency-file
// NONE:      build-args:
// NONE-SAME:   -fmodule-file={{(Mod=)?}}[[PREFIX]]/out/Mod_{{.*}}.pcm

// RUN: c-index-test core -scan-deps -working-dir %t -output-dir %t/out -serialize-diagnostics -- \
// RUN:   clang_tool -c %t/tu.c -fmodules -fmodules-cache-path=%t/cache \
// RUN:   -fimplicit-modules -fimplicit-module-maps \
// RUN:   -serialize-diagnostics %t/tu.diag -MD -MF %t/tu.d -o %t/tu.o \
// RUN: | FileCheck %s -DPREFIX=%/t -check-prefix=DIAGS

// DIAGS:        build-args:
// DIAGS-NOT:      -MT
// DIAGS-NOT:      -dependency-file
// DIAGS-SAME:     -serialize-diagnostic-file [[PREFIX]]/out/Mod_{{.*}}.diag
// DIAGS-NOT:      -MT
// DIAGS-NOT:      -dependency-file
// DIAGS:      build-args:
// DIAGS-SAME:   -fmodule-file={{(Mod=)?}}[[PREFIX]]/out/Mod_{{.*}}.pcm

// RUN: c-index-test core -scan-deps -working-dir %t -output-dir %t/out -dependency-file -- \
// RUN:   clang_tool -c %t/tu.c -fmodules -fmodules-cache-path=%t/cache \
// RUN:   -fimplicit-modules -fimplicit-module-maps \
// RUN:   -serialize-diagnostics %t/tu.diag -MD -MF %t/tu.d -o %t/tu.o \
// RUN: | FileCheck %s -DPREFIX=%/t -check-prefix=DEPS

// DEPS:        build-args:
// DEPS-NOT:      -serialize-diagnostic-file
// DEPS-SAME:     -MT [[PREFIX]]/out/Mod_{{.*}}.pcm
// DEPS-NOT:      -serialize-diagnostic-file
// DEPS-SAME:     -dependency-file [[PREFIX]]/out/Mod_{{.*}}.d
// DEPS-NOT:      -serialize-diagnostic-file
// DEPS:      build-args:
// DEPS-SAME:   -fmodule-file={{(Mod=)?}}[[PREFIX]]/out/Mod_{{.*}}.pcm

// RUN: c-index-test core -scan-deps -working-dir %t -output-dir %t/out -dependency-file -dependency-target foo -- \
// RUN:   clang_tool -c %t/tu.c -fmodules -fmodules-cache-path=%t/cache \
// RUN:   -fimplicit-modules -fimplicit-module-maps \
// RUN:   -serialize-diagnostics %t/tu.diag -MD -MF %t/tu.d -o %t/tu.o \
// RUN: | FileCheck %s -DPREFIX=%/t -check-prefix=DEPS_MT1

// DEPS_MT1:        build-args:
// DEPS_MT1-NOT:      -serialize-diagnostic-file
// DEPS_MT1-SAME:     -MT foo
// DEPS_MT1-NOT:      -serialize-diagnostic-file
// DEPS_MT1:      build-args:
// DEPS_MT1-SAME:   -fmodule-file={{(Mod=)?}}[[PREFIX]]/out/Mod_{{.*}}.pcm

// RUN: c-index-test core -scan-deps -working-dir %t -output-dir %t/out -dependency-file -dependency-target foo -dependency-target bar -- \
// RUN:   clang_tool -c %t/tu.c -fmodules -fmodules-cache-path=%t/cache \
// RUN:   -fimplicit-modules -fimplicit-module-maps \
// RUN:   -serialize-diagnostics %t/tu.diag -MD -MF %t/tu.d -o %t/tu.o \
// RUN: | FileCheck %s -DPREFIX=%/t -check-prefix=DEPS_MT2

// DEPS_MT2:        build-args:
// DEPS_MT2-NOT:      -serialize-diagnostic-file
// DEPS_MT2-SAME:     -MT foo
// DEPS_MT2-SAME:     -MT bar
// DEPS_MT2-NOT:      -serialize-diagnostic-file
// DEPS_MT2:      build-args:
// DEPS_MT2-SAME:   -fmodule-file={{(Mod=)?}}[[PREFIX]]/out/Mod_{{.*}}.pcm

// RUN: echo 'this_target_name_is_longer_than_the_256_byte_initial_buffer_size_to_test_that_we_alloc_and_call_again_with_a_sufficient_buffer_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX_end' > %t/target-name.txt
// RUN: cat %t/target-name.txt > %t/long.txt
// RUN: c-index-test core -scan-deps -working-dir %t -output-dir %t/out -dependency-file \
// RUN:     -dependency-target @%t/target-name.txt -- \
// RUN:   clang_tool -c %t/tu.c -fmodules -fmodules-cache-path=%t/cache \
// RUN:   -fimplicit-modules -fimplicit-module-maps \
// RUN:   -serialize-diagnostics %t/tu.diag -MD -MF %t/tu.d -o %t/tu.o \
// RUN: >> %t/long.txt
// RUN: FileCheck %s -check-prefix=LONG_OUT < %t/long.txt

// LONG_OUT: [[TARGET:this_target_.*_end]]
// LONG_OUT: -MT [[TARGET]]

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

//--- Mod.h

//--- tu.c
#include "Mod.h"