File tree Expand file tree Collapse file tree 2 files changed +60
-1
lines changed Expand file tree Collapse file tree 2 files changed +60
-1
lines changed Original file line number Diff line number Diff line change
1
+ // RUN: %clang_cc1 -std=c2x -ast-dump %s | FileCheck %s
2
+
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>
14
+
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.
22
+ #\
23
+ line \
24
+ 1000
25
+ "string literal" ;
26
+ // CHECK: ImplicitCastExpr {{.*}} <line:1000
27
+ // CHECK: StringLiteral {{.*}} <col:3>
28
+
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.
31
+ //
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
+ ) \
38
+ _\
39
+ _LINE__
40
+
41
+ _Static_assert (F (\
42
+ \
43
+ ) == 2007 );
44
+
45
+ // Reset the line number again for ease.
46
+ #line 2000
47
+ _Static_assert (2001 == \
48
+ __LI \
49
+ NE__ \
50
+ );
51
+ }
Original file line number Diff line number Diff line change @@ -696,7 +696,15 @@ <h2 id="c2x">C2x implementation status</h2>
696
696
< tr >
697
697
< td > Preprocessor line numbers unspecified</ td >
698
698
< td > < a href ="https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2322.htm "> N2322</ a > </ td >
699
- < td class ="full " align ="center "> Yes</ td >
699
+ < td class ="partial " align ="center ">
700
+ < details > < summary > Partial</ summary >
701
+ The line number associated with a macro invocation is not the line
702
+ number of the first character of the macro name in the invocation.
703
+ Additionally, Clang may not associate the line number of a pp-directive
704
+ with the first < code > #</ code > token. As these are recommended practices
705
+ and not normative requirements, Clang's behavior is still conforming.
706
+ </ details >
707
+ </ td >
700
708
</ tr >
701
709
< tr >
702
710
< td > deprecated attribute</ td >
You can’t perform that action at this time.
0 commit comments