mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 15:21:04 +01:00
Give Carbon -> C++ thunks internal linkage. (#7040)
Also declare them `inline` since we're putting the `always_inline` attribute on them. Use the `internal_linkage` attribute rather than `SC_Static` since it's a more precise mechanism and matches what we do for static member functions in reverse interop (where `SC_Static` means something else and would not give the function internal linkage).
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
auto foo(short a) -> void;
|
||||
// CHECK:STDOUT: |-FunctionDecl {{0x[a-f0-9]+}} <./thunk_required.h:[[@LINE-1]]:1, col:22> col:6 used foo 'auto (short) -> void'
|
||||
// CHECK:STDOUT: | `-ParmVarDecl {{0x[a-f0-9]+}} <col:10, col:16> col:16 a 'short'
|
||||
// CHECK:STDOUT: `-FunctionDecl {{0x[a-f0-9]+}} <col:6> col:6 foo__carbon_thunk 'void (short * _Nonnull)' extern
|
||||
// CHECK:STDOUT: `-FunctionDecl {{0x[a-f0-9]+}} <col:6> col:6 foo__carbon_thunk 'void (short * _Nonnull)' inline
|
||||
// CHECK:STDOUT: |-ParmVarDecl {{0x[a-f0-9]+}} <col:6> col:6 used a 'short * _Nonnull':'short *'
|
||||
// CHECK:STDOUT: |-ReturnStmt {{0x[a-f0-9]+}} <col:6>
|
||||
// CHECK:STDOUT: | `-CallExpr {{0x[a-f0-9]+}} <col:6> 'void'
|
||||
@@ -29,6 +29,7 @@ auto foo(short a) -> void;
|
||||
// CHECK:STDOUT: | `-ImplicitCastExpr {{0x[a-f0-9]+}} <col:6> 'short * _Nonnull':'short *' <LValueToRValue>
|
||||
// CHECK:STDOUT: | `-DeclRefExpr {{0x[a-f0-9]+}} <col:6> 'short * _Nonnull':'short *' lvalue ParmVar {{0x[a-f0-9]+}} 'a' 'short * _Nonnull':'short *'
|
||||
// CHECK:STDOUT: |-AlwaysInlineAttr {{0x[a-f0-9]+}} <<invalid sloc>> Implicit always_inline
|
||||
// CHECK:STDOUT: |-InternalLinkageAttr {{0x[a-f0-9]+}} <<invalid sloc>> Implicit
|
||||
// CHECK:STDOUT: `-AsmLabelAttr {{0x[a-f0-9]+}} <col:6> Implicit "_Z3foos.carbon_thunk"
|
||||
// CHECK:STDOUT: TranslationUnitDecl {{0x[a-f0-9]+}} <<invalid sloc>> <invalid sloc>
|
||||
|
||||
@@ -46,7 +47,7 @@ fn F() {
|
||||
|
||||
auto foo() -> short;
|
||||
// CHECK:STDOUT: |-FunctionDecl {{0x[a-f0-9]+}} <./return_thunk_required.h:[[@LINE-1]]:1, col:15> col:6 used foo 'auto () -> short'
|
||||
// CHECK:STDOUT: `-FunctionDecl {{0x[a-f0-9]+}} <col:6> col:6 foo__carbon_thunk 'void (short * _Nonnull)' extern
|
||||
// CHECK:STDOUT: `-FunctionDecl {{0x[a-f0-9]+}} <col:6> col:6 foo__carbon_thunk 'void (short * _Nonnull)' inline
|
||||
// CHECK:STDOUT: |-ParmVarDecl {{0x[a-f0-9]+}} <col:6> col:6 used return 'short * _Nonnull':'short *'
|
||||
// CHECK:STDOUT: |-CXXNewExpr {{0x[a-f0-9]+}} <col:6> 'short *' global Function {{0x[a-f0-9]+}} 'operator new' 'void *(__size_t, void *) noexcept'
|
||||
// CHECK:STDOUT: | |-CallExpr {{0x[a-f0-9]+}} <col:6> 'short'
|
||||
@@ -54,6 +55,7 @@ auto foo() -> short;
|
||||
// CHECK:STDOUT: | | `-DeclRefExpr {{0x[a-f0-9]+}} <col:6> 'auto () -> short' Function {{0x[a-f0-9]+}} 'foo' 'auto () -> short'
|
||||
// CHECK:STDOUT: | `-DeclRefExpr {{0x[a-f0-9]+}} <col:6> 'short * _Nonnull':'short *' lvalue ParmVar {{0x[a-f0-9]+}} 'return' 'short * _Nonnull':'short *'
|
||||
// CHECK:STDOUT: |-AlwaysInlineAttr {{0x[a-f0-9]+}} <<invalid sloc>> Implicit always_inline
|
||||
// CHECK:STDOUT: |-InternalLinkageAttr {{0x[a-f0-9]+}} <<invalid sloc>> Implicit
|
||||
// CHECK:STDOUT: `-AsmLabelAttr {{0x[a-f0-9]+}} <col:6> Implicit "_Z3foov.carbon_thunk"
|
||||
|
||||
// --- import_return_thunk_required.carbon
|
||||
|
||||
Reference in New Issue
Block a user