1 | int is_debug() { |
2 | #ifndef NDEBUG |
3 | return 1; // in debug mode |
4 | #else |
5 | return 0; |
6 | #endif |
7 | } |
8 | |
9 | /* This comment gets lexed along with the input above! We just don't CHECK it. |
10 | |
11 | RUN: clang-pseudo -source %s -print-source | FileCheck %s -check-prefix=SOURCE --strict-whitespace |
12 | SOURCE: int is_debug() { |
13 | SOURCE-NEXT: #ifndef NDEBUG |
14 | SOURCE-NEXT: return 1; // in debug mode |
15 | SOURCE-NEXT: #else |
16 | SOURCE-NEXT: return 0; |
17 | SOURCE-NEXT: #end |
18 | SOURCE-NEXT: } |
19 | |
20 | RUN: clang-pseudo -source %s -print-tokens | FileCheck %s -check-prefix=TOKEN |
21 | TOKEN: 0: raw_identifier 0:0 "int" flags=1 |
22 | TOKEN-NEXT: raw_identifier 0:0 "is_debug" |
23 | TOKEN-NEXT: l_paren 0:0 "(" |
24 | TOKEN-NEXT: r_paren 0:0 ")" |
25 | TOKEN-NEXT: l_brace 0:0 "{" |
26 | TOKEN-NEXT: hash 1:0 "#" flags=1 |
27 | TOKEN-NEXT: raw_identifier 1:0 "ifndef" |
28 | TOKEN-NEXT: raw_identifier 1:0 "NDEBUG" |
29 | TOKEN-NEXT: raw_identifier 2:2 "return" flags=1 |
30 | TOKEN-NEXT: numeric_constant 2:2 "1" |
31 | TOKEN-NEXT: semi 2:2 ";" |
32 | TOKEN-NEXT: comment 2:2 "// in debug mode" |
33 | TOKEN-NEXT: hash 3:0 "#" flags=1 |
34 | TOKEN-NEXT: raw_identifier 3:0 "else" |
35 | TOKEN-NEXT: raw_identifier 4:2 "return" flags=1 |
36 | TOKEN-NEXT: numeric_constant 4:2 "0" |
37 | TOKEN-NEXT: semi 4:2 ";" |
38 | TOKEN-NEXT: hash 5:0 "#" flags=1 |
39 | TOKEN-NEXT: raw_identifier 5:0 "endif" |
40 | TOKEN-NEXT: r_brace 6:0 "}" flags=1 |
41 | |
42 | *******************************************************************************/ |
43 | |