[C++ interop] Pass top-level declarations to the code generator. (#6237)

This allows us to lower indirectly-referenced C++ functions and
variables.
This commit is contained in:
Richard Smith
2025-10-17 17:10:14 +00:00
committed by GitHub
parent 4370acd1bb
commit 8cf4c4d10d
5 changed files with 54 additions and 32 deletions
+3
View File
@@ -4,6 +4,7 @@
#include "toolchain/check/cpp/thunk.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/GlobalDecl.h"
#include "clang/AST/Mangle.h"
#include "clang/Sema/Lookup.h"
@@ -569,6 +570,8 @@ auto BuildCppThunk(Context& context, const SemIR::Function& callee_function)
return nullptr;
}
context.clang_sema().getASTConsumer().HandleTopLevelDecl(
clang::DeclGroupRef(thunk_function_decl));
return thunk_function_decl;
}