Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / C / C2x / n2322.c
blobc5ac788fb6ed36dcf1525b8d887c9166a7f8183b
1 // RUN: %clang_cc1 -std=c2x -ast-dump %s | FileCheck %s
3 /* WG14 N2322: partial
4 * Preprocessor line numbers unspecified
5 */
6 void n2322() {
7 // The line number associated with a pp-token should be the line number of
8 // the first character of the pp-token.
9 "this string literal \
10 spans multiple lines \
11 before terminating";
12 // CHECK: ImplicitCastExpr {{.*}} <line:9
13 // CHECK-NEXT: StringLiteral {{.*}} <col:3>
15 // The line number associated with a pp-directive should be the line number
16 // of the line with the first # token.
17 // Possible FIXME: The AST node should be on line 1002 if we take the line
18 // number to be associated with the first # token. However, this relies on an
19 // interpretation of the standard definition of "presumed line" to be before
20 // line splices are removed. The standard leaves this unspecified, so this
21 // may not represent an actual issue.
23 line\
24 1000
25 "string literal";
26 // CHECK: ImplicitCastExpr {{.*}} <line:1000
27 // CHECK: StringLiteral {{.*}} <col:3>
29 // The line number associated with a macro invocation should be the line
30 // number of the first character of the macro name in the invocation.
32 // Reset the line number to make it easier to understand the next test.
33 // FIXME: The line number should be 2005 (first letter of the macro name) and
34 // not 2007 (closing parenthesis of the macro invocation).
35 #line 2000
36 #define F( \
37 ) \
39 _LINE__
41 _Static_assert(F(\
43 ) == 2007);
45 // Reset the line number again for ease.
46 #line 2000
47 _Static_assert(2001 == \
48 __LI\
49 NE__\