xref: /aosp_15_r20/external/clang/test/Modules/serialized-diags.m (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li@import HasWarnings;
2*67e74705SXin Li
3*67e74705SXin Li#ifdef WITH_ERRORS
4*67e74705SXin Li@import HasErrors;
5*67e74705SXin Li#endif
6*67e74705SXin Li
7*67e74705SXin Lifloat float_val;
8*67e74705SXin Lidouble *double_ptr = &float_val;
9*67e74705SXin Li
10*67e74705SXin Li// RUN: rm -rf %t %t.diag %t.out
11*67e74705SXin Li// RUN: %clang -fmodules -fmodules-cache-path=%t/ModuleCache -I %S/Inputs/ModuleDiags -fsyntax-only %s --serialize-diagnostics %t.diag > /dev/null 2>&1
12*67e74705SXin Li// RUN: c-index-test -read-diagnostics %t.diag > %t.out 2>&1
13*67e74705SXin Li// RUN: FileCheck --input-file=%t.out %s
14*67e74705SXin Li
15*67e74705SXin Li// CHECK: has_warnings.h:3:8: warning: incompatible pointer types initializing 'float *'
16*67e74705SXin Li// CHECK: serialized-diags.m:1:9: note: while building module 'HasWarnings' imported from
17*67e74705SXin Li// CHECK: serialized-diags.m:8:9: warning: incompatible pointer types initializing 'double *'
18*67e74705SXin Li// CHECK: Number of diagnostics: 2
19*67e74705SXin Li
20*67e74705SXin Li// RUN: rm -rf %t %t.diag_errors %t.out_errors
21*67e74705SXin Li// RUN: not %clang -fmodules -fmodules-cache-path=%t/ModuleCache -I %S/Inputs/ModuleDiags -fsyntax-only -DWITH_ERRORS %s --serialize-diagnostics %t.diag_errors > /dev/null 2>&1
22*67e74705SXin Li// RUN: c-index-test -read-diagnostics %t.diag_errors > %t.out_errors 2>&1
23*67e74705SXin Li// RUN: FileCheck -check-prefix=CHECK-WITH-ERRORS --input-file=%t.out_errors %s
24*67e74705SXin Li
25*67e74705SXin Li// CHECK-WITH-ERRORS: has_warnings.h:3:8: warning: incompatible pointer types initializing 'float *'
26*67e74705SXin Li// CHECK-WITH-ERRORS: serialized-diags.m:1:9: note: while building module 'HasWarnings'
27*67e74705SXin Li// CHECK-WITH-ERRORS: has_errors.h:2:13: error: redefinition of 'foo'
28*67e74705SXin Li// CHECK-WITH-ERRORS: serialized-diags.m:4:9: note: while building module 'HasErrors'
29*67e74705SXin Li// CHECK-WITH-ERRORS: has_errors.h:1:13: note: previous definition is here
30*67e74705SXin Li// CHECK-WITH-ERRORS: serialized-diags.m:4:9: fatal: could not build module 'HasErrors'
31*67e74705SXin Li// CHECK-WITH-ERRORS: Number of diagnostics: 3
32*67e74705SXin Li
33