mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 22:02:52 +01:00
Use clang_decls as the source of truth for function interop mapping (#7303)
Removing the clang_decl_id on SemIR::Function - using only the clang_decls map to create the association between SemIR::Function and clang::FunctionDecls. This adds an `is_external` flag to ClangDecl to indicate whether the entity originated from Carbon or was imported from another language. (I'm open to names - I guess for now we mostly use "is this from C++" to be more specific than "is this external" - eg: NameScope::is_cpp_scope)
This commit is contained in:
@@ -732,8 +732,8 @@ static auto GetAsCppFunctionDecl(Context& context, SemIR::InstId inst_id)
|
||||
if (!function_type) {
|
||||
return nullptr;
|
||||
}
|
||||
SemIR::ClangDeclId clang_decl_id =
|
||||
context.functions().Get(function_type->function_id).clang_decl_id;
|
||||
SemIR::ClangDeclId clang_decl_id = context.clang_decls().Lookup(
|
||||
context.functions().Get(function_type->function_id).first_decl_id());
|
||||
return clang_decl_id.has_value()
|
||||
? dyn_cast<clang::FunctionDecl>(
|
||||
context.clang_decls().Get(clang_decl_id).key.decl)
|
||||
|
||||
Reference in New Issue
Block a user