xref: /minix3/external/bsd/llvm/dist/clang/test/Index/fix-its.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: c-index-test -test-load-source all -fspell-checking %s 2> %t
2*f4a2713aSLionel Sambuc // RUN: FileCheck %s < %t
3*f4a2713aSLionel Sambuc struct X {
4*f4a2713aSLionel Sambuc   int wibble;
5*f4a2713aSLionel Sambuc };
6*f4a2713aSLionel Sambuc 
7*f4a2713aSLionel Sambuc #define MACRO(X) X
8*f4a2713aSLionel Sambuc 
f(struct X * x)9*f4a2713aSLionel Sambuc void f(struct X *x) {
10*f4a2713aSLionel Sambuc   // CHECK: error: no member named 'wobble' in 'struct X'; did you mean 'wibble'?
11*f4a2713aSLionel Sambuc   // CHECK: FIX-IT: Replace [13:12 - 13:18] with "wibble"
12*f4a2713aSLionel Sambuc   // CHECK: note: 'wibble' declared here
13*f4a2713aSLionel Sambuc   MACRO(x->wobble = 17);
14*f4a2713aSLionel Sambuc   // CHECK: error: no member named 'wabble' in 'struct X'; did you mean 'wibble'?
15*f4a2713aSLionel Sambuc   // CHECK: FIX-IT: Replace [17:6 - 17:12] with "wibble"
16*f4a2713aSLionel Sambuc   // CHECK: note: 'wibble' declared here
17*f4a2713aSLionel Sambuc   x->wabble = 17;
18*f4a2713aSLionel Sambuc }
19*f4a2713aSLionel Sambuc 
20*f4a2713aSLionel Sambuc int printf(const char *restrict, ...);
21*f4a2713aSLionel Sambuc 
f2()22*f4a2713aSLionel Sambuc void f2() {
23*f4a2713aSLionel Sambuc   unsigned long index;
24*f4a2713aSLionel Sambuc   // CHECK: warning: format specifies type 'int' but the argument has type 'unsigned long'
25*f4a2713aSLionel Sambuc   // CHECK: FIX-IT: Replace [26:17 - 26:19] with "%lu"
26*f4a2713aSLionel Sambuc   MACRO(printf("%d", index));
27*f4a2713aSLionel Sambuc }
28