blob: b5b619d655bb7ccb2ef773b922a4a5bac6e19ab7 [file] [log] [blame]
Ted Kremeneka7e8a832011-11-11 00:46:43 +00001void foo() {
2 int voodoo;
3 voodoo = voodoo + 1;
4}
5
6void bar() {
7 int dragon;
8 dragon = dragon + 1
9}
10
Ted Kremenek952538d2011-11-29 00:30:52 +000011// Test handling of FixIts that only remove text.
12int baz();
13void qux(int x) {
14 if ((x == baz()))
15 return;
16}
17
NAKAMURA Takumi6edae592011-11-11 05:12:45 +000018// RUN: rm -f %t
Ted Kremenek13eee192011-12-07 02:08:00 +000019// RUN: %clang -Wall -fsyntax-only %s --serialize-diagnostics %t > /dev/null 2>&1 || true
Ted Kremeneka7e8a832011-11-11 00:46:43 +000020// RUN: c-index-test -read-diagnostics %t 2>&1 | FileCheck %s
Ted Kremeneka7e8a832011-11-11 00:46:43 +000021
22// This test case tests that we can handle multiple diagnostics which contain
23// FIXITs at different levels (one at the note, another at the main diagnostic).
24
NAKAMURA Takumi6edae592011-11-11 05:12:45 +000025// CHECK: {{.*[/\\]}}serialized-diags.c:3:12: warning: variable 'voodoo' is uninitialized when used here [-Wuninitialized]
26// CHECK: Range: {{.*[/\\]}}serialized-diags.c:3:12 {{.*[/\\]}}serialized-diags.c:3:18
27// CHECK: +-{{.*[/\\]}}serialized-diags.c:2:13: note: initialize the variable 'voodoo' to silence this warning []
NAKAMURA Takumi40f69752011-11-11 07:27:33 +000028// CHECK: +-FIXIT: ({{.*[/\\]}}serialized-diags.c:2:13 - {{.*[/\\]}}serialized-diags.c:2:13): " = 0"
NAKAMURA Takumi6edae592011-11-11 05:12:45 +000029// CHECK: {{.*[/\\]}}serialized-diags.c:8:22: error: expected ';' after expression []
30// CHECK: FIXIT: ({{.*[/\\]}}serialized-diags.c:8:22 - {{.*[/\\]}}serialized-diags.c:8:22): ";"
Ted Kremenek952538d2011-11-29 00:30:52 +000031// CHECK: {{.*[/\\]}}serialized-diags.c:14:10: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
32// CHECK: Range: {{.*[/\\]}}serialized-diags.c:14:8 {{.*[/\\]}}serialized-diags.c:14:18
33// CHECK: +-{{.*[/\\]}}serialized-diags.c:14:10: note: remove extraneous parentheses around the comparison to silence this warning []
34// CHECK: +-FIXIT: ({{.*[/\\]}}serialized-diags.c:14:7 - {{.*[/\\]}}serialized-diags.c:14:8): ""
35// CHECK: +-FIXIT: ({{.*[/\\]}}serialized-diags.c:14:18 - {{.*[/\\]}}serialized-diags.c:14:19): ""
36// CHECK: +-{{.*[/\\]}}serialized-diags.c:14:10: note: use '=' to turn this equality comparison into an assignment []
37// CHECK: +-FIXIT: ({{.*[/\\]}}serialized-diags.c:14:10 - {{.*[/\\]}}serialized-diags.c:14:12): "="
38// CHECK: Number of diagnostics: 3
39