blob: 27f8b8b602ff1f5db02a01d9d560ab81bd04be23 [file] [log] [blame]
Ted Kremeneka7e8a832011-11-11 00:46:43 +00001void foo() {
2 int voodoo;
3 voodoo = voodoo + 1;
4}
5
6// RUN: %clang -Wall -fsyntax-only %s --serialize-diagnostics %t
7// RUN: c-index-test -read-diagnostics %t 2>&1 | FileCheck %s
8// RUN: rm -f %t
9
10// NOTE: it is important that this test case only contain a single issue. This test case checks
11// if we can handle serialized diagnostics that contain only one diagnostic.
12
13// CHECK: {{.*}}serialized-diags-single-issue.c:3:12: warning: variable 'voodoo' is uninitialized when used here [-Wuninitialized]
14// CHECK: Range: {{.*}}serialized-diags-single-issue.c:3:12 {{.*}}serialized-diags-single-issue.c:3:18
15// CHECK: +-{{.*}}serialized-diags-single-issue.c:2:13: note: initialize the variable 'voodoo' to silence this warning []
Argyrios Kyrtzidis29f27872011-12-07 05:52:12 +000016// CHECK: +-FIXIT: {{.*}}serialized-diags-single-issue.c:2:13 - {{.*}}serialized-diags-single-issue.c:2:13): " = 0"
17
18// Test that we handle serializing diagnostics for multiple source files
19// RUN: %clang_cc1 -Wall -fsyntax-only %s %s -serialize-diagnostic-file %t
20// RUN: c-index-test -read-diagnostics %t 2>&1 | FileCheck -check-prefix=CHECK-MULT %s
21// RUN: rm -f %t
22
23// CHECK-MULT: {{.*}}serialized-diags-single-issue.c:3:12: warning: variable 'voodoo' is uninitialized when used here [-Wuninitialized]
24// CHECK-MULT: Range: {{.*}}serialized-diags-single-issue.c:3:12 {{.*}}serialized-diags-single-issue.c:3:18
25// CHECK-MULT: +-{{.*}}serialized-diags-single-issue.c:2:13: note: initialize the variable 'voodoo' to silence this warning []
26// CHECK-MULT: +-FIXIT: {{.*}}serialized-diags-single-issue.c:2:13 - {{.*}}serialized-diags-single-issue.c:2:13): " = 0"
27
28// CHECK-MULT: {{.*}}serialized-diags-single-issue.c:3:12: warning: variable 'voodoo' is uninitialized when used here [-Wuninitialized]
29// CHECK-MULT: Range: {{.*}}serialized-diags-single-issue.c:3:12 {{.*}}serialized-diags-single-issue.c:3:18
30// CHECK-MULT: +-{{.*}}serialized-diags-single-issue.c:2:13: note: initialize the variable 'voodoo' to silence this warning []
31// CHECK-MULT: +-FIXIT: {{.*}}serialized-diags-single-issue.c:2:13 - {{.*}}serialized-diags-single-issue.c:2:13): " = 0"
32
33// CHECK-MULT: Number of diagnostics: 2