[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang-tools-extra / pseudo / test / strip-directives.c
blobc7878d9295a08ab943def18fa1294d0521bf4d8d
1 #include <stdio.h>
2 int main() {
3 #error This was inevitable...
4 #if HELLO
5 printf("hello, world\n");
6 return 0;
7 #else
8 abort();
9 #endif
12 /* This comment gets lexed along with the input above! We just don't CHECK it.
14 RUN: clang-pseudo -source %s -print-directive-tree | FileCheck %s -check-prefix=PPT --strict-whitespace
15 PPT: #include (7 tokens)
16 PPT-NEXT: code (5 tokens)
17 PPT-NEXT: #error (6 tokens)
18 PPT-NEXT: #if (3 tokens) TAKEN
19 PPT-NEXT: code (8 tokens)
20 PPT-NEXT: #else (2 tokens)
21 PPT-NEXT: code (4 tokens)
22 PPT-NEXT: #endif (2 tokens)
23 PPT-NEXT: code (2 tokens)
24 ^ including this block comment
26 RUN: clang-pseudo -source %s -strip-directives -print-source | FileCheck %s --strict-whitespace
27 CHECK: int main() {
28 CHECK-NEXT: printf("hello, world\n");
29 CHECK-NEXT: return 0;
30 CHECK-NEXT: }
32 RUN: clang-pseudo -source %s -strip-directives -print-tokens | FileCheck %s --check-prefix=TOKEN
33 TOKEN: 0: raw_identifier 1:0 "int" flags=1
34 TOKEN-NEXT: raw_identifier 1:0 "main"
35 TOKEN-NEXT: l_paren 1:0 "("
36 TOKEN-NEXT: r_paren 1:0 ")"
37 TOKEN-NEXT: l_brace 1:0 "{"
38 TOKEN-NEXT: raw_identifier 4:2 "printf" flags=1
39 TOKEN-NEXT: l_paren 4:2 "("
40 TOKEN-NEXT: string_literal 4:2 "\22hello, world\\n\22"
41 TOKEN-NEXT: r_paren 4:2 ")"
42 TOKEN-NEXT: semi 4:2 ";"
43 TOKEN-NEXT: raw_identifier 5:2 "return" flags=1
44 TOKEN-NEXT: numeric_constant 5:2 "0"
45 TOKEN-NEXT: semi 5:2 ";"
46 TOKEN-NEXT: r_brace 9:0 "}" flags=1
48 *******************************************************************************/