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:
@@ -303,11 +303,12 @@ auto MaybeModifyCppThunkCallForConstEval(Context& context, SemIR::Call* call)
|
||||
.GetAs<SemIR::FunctionDecl>(thunk_callee_inst_id)
|
||||
.function_id);
|
||||
|
||||
function_decl =
|
||||
cast<clang::FunctionDecl>(context.clang_decls()
|
||||
.Get(thunk_callee_function.clang_decl_id)
|
||||
.GetAsKey()
|
||||
.decl);
|
||||
function_decl = cast<clang::FunctionDecl>(
|
||||
context.clang_decls()
|
||||
.Get(context.clang_decls().Lookup(
|
||||
thunk_callee_function.first_decl_id()))
|
||||
.GetAsKey()
|
||||
.decl);
|
||||
|
||||
if (!(function_decl->isConstexpr() || function_decl->isConsteval())) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user