mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 09:51:04 +01:00
Handle signature mismatch when a Carbon function overrides a C++ virtual function. (#7499)
When a Carbon virtual function overrides a C++ virtual function, we need to export it with the C++ signature in order for it to work as an override. Instead of mapping the C++ signature into Carbon and then back again, use the original C++ signature from the base class as the signature exported to C++. Also add documentation explaining how we use thunks in C++ interop, including in this new virtual function handling logic.
This commit is contained in:
@@ -903,11 +903,8 @@ static auto GetVirtualFunctionParamPassingMode(clang::QualType type)
|
||||
return SemIR::ClangDeclSignature::PassingMode::ByVar;
|
||||
}
|
||||
|
||||
// Computes the signature to use for the given imported virtual function. Unlike
|
||||
// with regular imported functions, we can only use a single signature here, so
|
||||
// we pick one conservatively.
|
||||
static auto MakeVirtualFunctionSignature(
|
||||
Context& context, const clang::CXXMethodDecl* method_decl)
|
||||
auto MakeVirtualFunctionSignature(Context& context,
|
||||
const clang::CXXMethodDecl* method_decl)
|
||||
-> SemIR::ClangDeclSignatureId {
|
||||
SemIR::ClangDeclSignature signature = {
|
||||
.kind = SemIR::ClangDeclSignature::Normal,
|
||||
|
||||
Reference in New Issue
Block a user