[clang-format] Fix a bug in aligning comments above PPDirective (#72791)
[llvm-project.git] / clang / test / Preprocessor / suggest-typoed-directive.c
blobc7130ad8031caf3e0b96f69197ce4649f0dbe361
1 // RUN: %clang_cc1 -fsyntax-only -verify=pre-c2x-cpp23 %s
2 // RUN: %clang_cc1 -std=c2x -fsyntax-only -verify=c2x-cpp23 %s
3 // RUN: %clang_cc1 -x c++ -std=c++23 -fsyntax-only -verify=c2x-cpp23 %s
4 // RUN: %clang_cc1 -x c++ -std=c++23 -fsyntax-only %s -fdiagnostics-parseable-fixits 2>&1 | FileCheck %s
6 // id: pre-c2x-cpp23-warning@+12 {{invalid preprocessing directive, did you mean '#if'?}}
7 // ifd: pre-c2x-cpp23-warning@+12 {{invalid preprocessing directive, did you mean '#if'?}}
8 // ifde: pre-c2x-cpp23-warning@+12 {{invalid preprocessing directive, did you mean '#ifdef'?}}
9 // elf: pre-c2x-cpp23-warning@+12 {{invalid preprocessing directive, did you mean '#elif'?}}
10 // elsif: pre-c2x-cpp23-warning@+12 {{invalid preprocessing directive, did you mean '#elif'?}}
11 // elseif: pre-c2x-cpp23-warning@+12 {{invalid preprocessing directive, did you mean '#elif'?}}
12 // elfidef: not suggested to '#elifdef'
13 // elfindef: not suggested to '#elifdef'
14 // elfinndef: not suggested to '#elifndef'
15 // els: pre-c2x-cpp23-warning@+12 {{invalid preprocessing directive, did you mean '#else'?}}
16 // endi: pre-c2x-cpp23-warning@+12 {{invalid preprocessing directive, did you mean '#endif'?}}
17 #ifdef UNDEFINED
18 #id
19 #ifd
20 #ifde
21 # elf
22 # elsif
23 #elseif
24 #elfidef
25 #elfindef
26 #elfinndef
27 #els
28 #endi
29 #endif
30 // id: c2x-cpp23-warning@-12 {{invalid preprocessing directive, did you mean '#if'?}}
31 // ifd: c2x-cpp23-warning@-12 {{invalid preprocessing directive, did you mean '#if'?}}
32 // ifde: c2x-cpp23-warning@-12 {{invalid preprocessing directive, did you mean '#ifdef'?}}
33 // elf: c2x-cpp23-warning@-12 {{invalid preprocessing directive, did you mean '#elif'?}}
34 // elsif: c2x-cpp23-warning@-12 {{invalid preprocessing directive, did you mean '#elif'?}}
35 // elseif: c2x-cpp23-warning@-12 {{invalid preprocessing directive, did you mean '#elif'?}}
36 // elfidef: c2x-cpp23-warning@-12 {{invalid preprocessing directive, did you mean '#elifdef'?}}
37 // elfindef: c2x-cpp23-warning@-12 {{invalid preprocessing directive, did you mean '#elifdef'?}}
38 // elfinndef: c2x-cpp23-warning@-12 {{invalid preprocessing directive, did you mean '#elifndef'?}}
39 // els: c2x-cpp23-warning@-12 {{invalid preprocessing directive, did you mean '#else'?}}
40 // endi: c2x-cpp23-warning@-12 {{invalid preprocessing directive, did you mean '#endif'?}}
42 // CHECK: fix-it:{{.*}}:{[[@LINE-24]]:2-[[@LINE-24]]:4}:"if"
43 // CHECK: fix-it:{{.*}}:{[[@LINE-24]]:2-[[@LINE-24]]:5}:"if"
44 // CHECK: fix-it:{{.*}}:{[[@LINE-24]]:2-[[@LINE-24]]:6}:"ifdef"
45 // CHECK: fix-it:{{.*}}:{[[@LINE-24]]:3-[[@LINE-24]]:6}:"elif"
46 // CHECK: fix-it:{{.*}}:{[[@LINE-24]]:4-[[@LINE-24]]:9}:"elif"
47 // CHECK: fix-it:{{.*}}:{[[@LINE-24]]:2-[[@LINE-24]]:8}:"elif"
48 // CHECK: fix-it:{{.*}}:{[[@LINE-24]]:2-[[@LINE-24]]:9}:"elifdef"
49 // CHECK: fix-it:{{.*}}:{[[@LINE-24]]:2-[[@LINE-24]]:10}:"elifdef"
50 // CHECK: fix-it:{{.*}}:{[[@LINE-24]]:2-[[@LINE-24]]:11}:"elifndef"
51 // CHECK: fix-it:{{.*}}:{[[@LINE-24]]:2-[[@LINE-24]]:5}:"else"
52 // CHECK: fix-it:{{.*}}:{[[@LINE-24]]:2-[[@LINE-24]]:6}:"endif"
54 #ifdef UNDEFINED
55 #i // no diagnostic
56 #endif
58 #if special_compiler
59 #special_compiler_directive // no diagnostic
60 #endif