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