2
2
// matter in this test.
3
3
4
4
// pcherror-error@* {{PCH file contains compiler errors}}
5
- @import error; // notallowerror-error {{could not build module 'error'}}
5
+ @import use_error_a; // notallowerror-error {{could not build module 'use_error_a'}}
6
+ @import use_error_b;
6
7
// expected-no-diagnostics
7
8
8
9
void test (Error *x) {
10
+ funca (x);
11
+ funcb (x);
9
12
[x method ];
10
13
}
11
14
@@ -16,41 +19,66 @@ void test(Error *x) {
16
19
// RUN: %clang_cc1 -fmodules -fallow-pcm-with-compiler-errors \
17
20
// RUN: -fmodule-name=error -o %t/prebuilt/error.pcm \
18
21
// RUN: -x objective-c -emit-module %S/Inputs/error/module.modulemap
22
+ // RUN: %clang_cc1 -fmodules -fallow-pcm-with-compiler-errors \
23
+ // RUN: -fmodule-file=error=%t/prebuilt/error.pcm \
24
+ // RUN: -fmodule-name=use_error_a -o %t/prebuilt/use_error_a.pcm \
25
+ // RUN: -x objective-c -emit-module %S/Inputs/error/module.modulemap
26
+ // RUN: %clang_cc1 -fmodules -fallow-pcm-with-compiler-errors \
27
+ // RUN: -fmodule-file=error=%t/prebuilt/error.pcm \
28
+ // RUN: -fmodule-name=use_error_b -o %t/prebuilt/use_error_b.pcm \
29
+ // RUN: -x objective-c -emit-module %S/Inputs/error/module.modulemap
19
30
31
+ // Prebuilt modules
20
32
// RUN: %clang_cc1 -fsyntax-only -fmodules -fallow-pcm-with-compiler-errors \
21
33
// RUN: -fprebuilt-module-path=%t/prebuilt -fmodules-cache-path=%t \
22
34
// RUN: -ast-print %s | FileCheck %s
23
35
// RUN: %clang_cc1 -fsyntax-only -fmodules \
24
36
// RUN: -fprebuilt-module-path=%t/prebuilt -fmodules-cache-path=%t \
25
37
// RUN: -verify=pcherror %s
26
38
39
+ // Explicit prebuilt modules (loaded when needed)
27
40
// RUN: %clang_cc1 -fsyntax-only -fmodules -fallow-pcm-with-compiler-errors \
28
- // RUN: -fmodule-file=error=%t/prebuilt/error.pcm -fmodules-cache-path=%t \
29
- // RUN: -ast-print %s | FileCheck %s
41
+ // RUN: -fmodule-file=error=%t/prebuilt/error.pcm \
42
+ // RUN: -fmodule-file=use_error_a=%t/prebuilt/use_error_a.pcm \
43
+ // RUN: -fmodule-file=use_error_b=%t/prebuilt/use_error_b.pcm \
44
+ // RUN: -fmodules-cache-path=%t -ast-print %s | FileCheck %s
30
45
// RUN: %clang_cc1 -fsyntax-only -fmodules \
31
- // RUN: -fmodule-file=error=%t/prebuilt/error.pcm -fmodules-cache-path=%t \
32
- // RUN: -verify=pcherror %s
46
+ // RUN: -fmodule-file=error=%t/prebuilt/error.pcm \
47
+ // RUN: -fmodule-file=use_error_a=%t/prebuilt/use_error_a.pcm \
48
+ // RUN: -fmodule-file=use_error_b=%t/prebuilt/use_error_b.pcm \
49
+ // RUN: -fmodules-cache-path=%t -verify=pcherror %s
33
50
51
+ // Explicit prebuilt modules without name (always loaded)
34
52
// RUN: %clang_cc1 -fsyntax-only -fmodules -fallow-pcm-with-compiler-errors \
35
- // RUN: -fmodule-file=%t/prebuilt/error.pcm -fmodules-cache-path=%t \
36
- // RUN: -ast-print %s | FileCheck %s
53
+ // RUN: -fmodule-file=%t/prebuilt/error.pcm \
54
+ // RUN: -fmodule-file=%t/prebuilt/use_error_a.pcm \
55
+ // RUN: -fmodule-file=%t/prebuilt/use_error_b.pcm \
56
+ // RUN: -fmodules-cache-path=%t -ast-print %s | FileCheck %s
57
+ // As the modules are always loaded, compiling will fail before even parsing
58
+ // this file - this means that -verify can't be used, so do a grep instead.
37
59
// RUN: not %clang_cc1 -fsyntax-only -fmodules \
38
- // RUN: -fmodule-file=%t/prebuilt/error.pcm -fmodules-cache-path=%t \
39
- // RUN: -verify=pcherror %s
60
+ // RUN: -fmodule-file=%t/prebuilt/error.pcm \
61
+ // RUN: -fmodule-file=%t/prebuilt/use_error_a.pcm \
62
+ // RUN: -fmodule-file=%t/prebuilt/use_error_b.pcm \
63
+ // RUN: -fmodules-cache-path=%t 2>&1 | \
64
+ // RUN: grep "PCH file contains compiler errors"
40
65
41
- // Shouldn't build the cached module (that has errors) when not allowing errors
66
+ // Shouldn't build the cached modules (that have errors) when not allowing
67
+ // errors
42
68
// RUN: not %clang_cc1 -fsyntax-only -fmodules \
43
69
// RUN: -fmodules-cache-path=%t -fimplicit-module-maps -I %S/Inputs/error \
44
70
// RUN: -x objective-c %s
45
71
// RUN: find %t -name "error-*.pcm" | not grep error
46
72
47
- // Should build the cached module when allowing errors
73
+ // Should build the cached modules when allowing errors
48
74
// RUN: %clang_cc1 -fsyntax-only -fmodules -fallow-pcm-with-compiler-errors \
49
75
// RUN: -fmodules-cache-path=%t -fimplicit-module-maps -I %S/Inputs/error \
50
76
// RUN: -x objective-c -verify %s
51
77
// RUN: find %t -name "error-*.pcm" | grep error
78
+ // RUN: find %t -name "use_error_a-*.pcm" | grep use_error_a
79
+ // RUN: find %t -name "use_error_b-*.pcm" | grep use_error_b
52
80
53
- // Make sure there is still an error after the module is already in the cache
81
+ // Check build when the modules are already cached
54
82
// RUN: %clang_cc1 -fsyntax-only -fmodules -fallow-pcm-with-compiler-errors \
55
83
// RUN: -fmodules-cache-path=%t -fimplicit-module-maps -I %S/Inputs/error \
56
84
// RUN: -x objective-c -verify %s
@@ -59,7 +87,7 @@ void test(Error *x) {
59
87
// the verify would fail as it would be the PCH error instead)
60
88
// RUN: %clang_cc1 -fsyntax-only -fmodules \
61
89
// RUN: -fmodules-cache-path=%t -fimplicit-module-maps -I %S/Inputs/error \
62
- // RUN: -x objective-c -verify=notallowerror %s
90
+ // RUN: -x objective-c %s -verify=notallowerror
63
91
64
92
// allow-pcm-with-compiler-errors should also allow errors in PCH
65
93
// RUN: %clang_cc1 -fallow-pcm-with-compiler-errors -x objective-c \
@@ -71,15 +99,17 @@ void test(Error *x) {
71
99
// CHECK-NEXT: @end
72
100
// CHECK: void test(Error *x)
73
101
74
- // RUN: c-index-test -code-completion-at=%s:9 :6 %s -fmodules -fmodules-cache-path=%t \
102
+ // RUN: c-index-test -code-completion-at=%s:12 :6 %s -fmodules -fmodules-cache-path=%t \
75
103
// RUN: -Xclang -fallow-pcm-with-compiler-errors -I %S/Inputs/error | FileCheck -check-prefix=COMPLETE %s
76
104
// COMPLETE: ObjCInstanceMethodDecl:{ResultType int}{TypedText method}
77
105
// COMPLETE: ObjCInstanceMethodDecl:{ResultType id}{TypedText method2}
78
106
79
107
// RUN: c-index-test -test-load-source local %s -fmodules -fmodules-cache-path=%t \
80
108
// RUN: -Xclang -fallow-pcm-with-compiler-errors -I %S/Inputs/error | FileCheck -check-prefix=SOURCE %s
81
- // SOURCE: load-module-with-errors.m:8:6: FunctionDecl=test:8:6 (Definition) Extent=[8:1 - 10:2]
82
- // SOURCE: load-module-with-errors.m:8:18: ParmDecl=x:8:18 (Definition) Extent=[8:11 - 8:19]
83
- // SOURCE: load-module-with-errors.m:8:11: ObjCClassRef=Error:3:12 Extent=[8:11 - 8:16]
84
- // SOURCE: load-module-with-errors.m:8:21: CompoundStmt= Extent=[8:21 - 10:2]
85
- // SOURCE: load-module-with-errors.m:9:3: ObjCMessageExpr=method:4:8 Extent=[9:3 - 9:13]
109
+ // SOURCE: load-module-with-errors.m:9:6: FunctionDecl=test:9:6 (Definition) Extent=[9:1 - 13:2]
110
+ // SOURCE: load-module-with-errors.m:9:18: ParmDecl=x:9:18 (Definition) Extent=[9:11 - 9:19]
111
+ // SOURCE: load-module-with-errors.m:9:11: ObjCClassRef=Error:5:12 Extent=[9:11 - 9:16]
112
+ // SOURCE: load-module-with-errors.m:9:21: CompoundStmt= Extent=[9:21 - 13:2]
113
+ // SOURCE: load-module-with-errors.m:10:3: CallExpr=funca:3:6 Extent=[10:3 - 10:11]
114
+ // SOURCE: load-module-with-errors.m:11:3: CallExpr=funcb:3:6 Extent=[11:3 - 11:11]
115
+ // SOURCE: load-module-with-errors.m:12:3: ObjCMessageExpr=method:6:8 Extent=[12:3 - 12:13]
0 commit comments