mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 09:14:42 +01:00
Support for converting a function to a C++ function pointer (#7789)
This commit is contained in:
@@ -77,11 +77,21 @@ auto ExportFieldToCpp(Context& context, SemIR::InstId field_inst_id,
|
||||
SemIR::FieldDecl field_decl,
|
||||
SemIR::SpecificId specific_id) -> clang::FieldDecl*;
|
||||
|
||||
// Get a `clang::FunctionDecl` that can be used to call a Carbon function.
|
||||
// If the function is generic, a `clang::FunctionTemplateDecl` will be
|
||||
// created instead.
|
||||
auto ExportFunctionToCpp(Context& context, SemIR::LocId loc_id,
|
||||
SemIR::FunctionId function_id) -> clang::NamedDecl*;
|
||||
// Returns the `ClangDeclId` of a `clang::FunctionDecl` or
|
||||
// `clang::FunctionTemplateDecl` that can be used to call the given function.
|
||||
// Returns null if an error was diagnosed.
|
||||
auto GetOrExportFunctionToCpp(Context& context, SemIR::LocId loc_id,
|
||||
SemIR::FunctionId function_id)
|
||||
-> clang::NamedDecl*;
|
||||
|
||||
// Exports the necessary declarations to permit conversion from the given
|
||||
// Carbon function type to the given C++ function pointer type. If the
|
||||
// conversion would be invalid, this will return false, and if `diagnose` is
|
||||
// true it will also emit one or more diagnostics explaining the reason it would
|
||||
// be invalid. In those diagnostics, `src_id` is the source of the conversion.
|
||||
auto ExportFunctionToCppPointerConversion(
|
||||
Context& context, SemIR::InstId src_id, SemIR::FunctionType src_type,
|
||||
SemIR::CppFunctionPointerType dest_type, bool diagnose) -> bool;
|
||||
|
||||
// Exports a Carbon virtual function as a C++ `clang::FunctionDecl` declaration.
|
||||
// Does not emit a definition.
|
||||
|
||||
Reference in New Issue
Block a user