xref: /llvm-project/clang/test/Index/fix-its.c (revision 1eb342920b33cda278a913435daad6e1dece6396)
114923965SDouglas Gregor // RUN: c-index-test -test-load-source all -fspell-checking %s 2> %t
214923965SDouglas Gregor // RUN: FileCheck %s < %t
314923965SDouglas Gregor struct X {
414923965SDouglas Gregor   int wibble;
514923965SDouglas Gregor };
614923965SDouglas Gregor 
714923965SDouglas Gregor #define MACRO(X) X
814923965SDouglas Gregor 
f(struct X * x)914923965SDouglas Gregor void f(struct X *x) {
1014923965SDouglas Gregor   // CHECK: error: no member named 'wobble' in 'struct X'; did you mean 'wibble'?
11408403c4SArgyrios Kyrtzidis   // CHECK: FIX-IT: Replace [13:12 - 13:18] with "wibble"
1214923965SDouglas Gregor   // CHECK: note: 'wibble' declared here
1314923965SDouglas Gregor   MACRO(x->wobble = 17);
1414923965SDouglas Gregor   // CHECK: error: no member named 'wabble' in 'struct X'; did you mean 'wibble'?
1514923965SDouglas Gregor   // CHECK: FIX-IT: Replace [17:6 - 17:12] with "wibble"
1614923965SDouglas Gregor   // CHECK: note: 'wibble' declared here
1714923965SDouglas Gregor   x->wabble = 17;
1814923965SDouglas Gregor }
19408403c4SArgyrios Kyrtzidis 
20408403c4SArgyrios Kyrtzidis int printf(const char *restrict, ...);
21408403c4SArgyrios Kyrtzidis 
f2()22408403c4SArgyrios Kyrtzidis void f2() {
23408403c4SArgyrios Kyrtzidis   unsigned long index;
24408403c4SArgyrios Kyrtzidis   // CHECK: warning: format specifies type 'int' but the argument has type 'unsigned long'
25*1eb34292SJordan Rose   // CHECK: FIX-IT: Replace [26:17 - 26:19] with "%lu"
26408403c4SArgyrios Kyrtzidis   MACRO(printf("%d", index));
27408403c4SArgyrios Kyrtzidis }
28