52 lines · c
1// RUN: %clang_cc1 -std=c2x -ast-dump %s | FileCheck %s2 3/* WG14 N2322: partial4 * Preprocessor line numbers unspecified5 */6void n2322() {7 // The line number associated with a pp-token should be the line number of8 // the first character of the pp-token.9 "this string literal \10 spans multiple lines \11 before terminating";12// CHECK: ImplicitCastExpr {{.*}} <line:913// CHECK-NEXT: StringLiteral {{.*}} <col:3>14 15 // The line number associated with a pp-directive should be the line number16 // of the line with the first # token.17 // Possible FIXME: The AST node should be on line 1002 if we take the line18 // number to be associated with the first # token. However, this relies on an19 // interpretation of the standard definition of "presumed line" to be before20 // line splices are removed. The standard leaves this unspecified, so this21 // may not represent an actual issue.22 #\23 line\24 100025 "string literal";26// CHECK: ImplicitCastExpr {{.*}} <line:100027// CHECK: StringLiteral {{.*}} <col:3>28 29 // The line number associated with a macro invocation should be the line30 // 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) and34 // not 2007 (closing parenthesis of the macro invocation).35 #line 200036 #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 200047 _Static_assert(2001 == \48__LI\49NE__\50 );51}52