Remove "__cpp_thunk" from thunk name for exported functions (#7092)

This makes the behavior consistent between methods and regular
functions, and fixes the behavior with `using` aliases (see new
`using.carbon` test).

As requested in
https://github.com/carbon-language/carbon-lang/pull/7078#discussion_r3121104954.
This commit is contained in:
Nicholas Bishop
2026-04-22 18:05:02 +00:00
committed by GitHub
parent 790cb6e6fe
commit 67648b4d49
6 changed files with 37 additions and 31 deletions
@@ -57,6 +57,19 @@ void G() {
}
''';
// --- using.carbon
library "[[@TEST_NAME]]";
import Cpp;
fn F();
inline Cpp '''
using Carbon::F;
void G() { F(); }
''';
// --- fail_todo_generic.carbon
library "[[@TEST_NAME]]";
@@ -21,7 +21,7 @@ library "[[@TEST_NAME]]";
import Cpp;
fn F(i: i32) -> i32 {
// CHECK:STDOUT: | `-FunctionDecl {{0x[a-f0-9]+}} <thunk_with_args_and_return.carbon:[[@LINE-1]]:21> col:21 used F__cpp_thunk 'int (int)' inline
// CHECK:STDOUT: | `-FunctionDecl {{0x[a-f0-9]+}} <thunk_with_args_and_return.carbon:[[@LINE-1]]:21> col:21 used F 'int (int)' inline
// CHECK:STDOUT: | |-ParmVarDecl {{0x[a-f0-9]+}} <col:21> col:21 used 'int'
// CHECK:STDOUT: | |-CompoundStmt {{0x[a-f0-9]+}} <col:21>
// CHECK:STDOUT: | | |-DeclStmt {{0x[a-f0-9]+}} <col:21>
@@ -41,7 +41,7 @@ fn F(i: i32) -> i32 {
// CHECK:STDOUT: `-ReturnStmt {{0x[a-f0-9]+}} <line:36:3, col:21>
// CHECK:STDOUT: `-CallExpr {{0x[a-f0-9]+}} <col:10, col:21> 'int'
// CHECK:STDOUT: |-ImplicitCastExpr {{0x[a-f0-9]+}} <col:10, col:18> 'int (*)(int)' <FunctionToPointerDecay>
// CHECK:STDOUT: | `-DeclRefExpr {{0x[a-f0-9]+}} <col:10, col:18> 'int (int)' lvalue Function {{0x[a-f0-9]+}} 'F__cpp_thunk' 'int (int)'
// CHECK:STDOUT: | `-DeclRefExpr {{0x[a-f0-9]+}} <col:10, col:18> 'int (int)' lvalue Function {{0x[a-f0-9]+}} 'F' 'int (int)'
// CHECK:STDOUT: | `-NestedNameSpecifier Namespace {{0x[a-f0-9]+}} 'Carbon'
// CHECK:STDOUT: `-ImplicitCastExpr {{0x[a-f0-9]+}} <col:20> 'int' <LValueToRValue>
// CHECK:STDOUT: `-DeclRefExpr {{0x[a-f0-9]+}} <col:20> 'int' lvalue ParmVar {{0x[a-f0-9]+}} 'i' 'int'