Create modules for header imports. (#7613)

Make multiple imports of the same header only parse it once per C++
domain. Reuse of the same header in `--share-cpp-ast` mode now reuses
the representation.

Importing a Carbon file with C++ dependencies now makes those transitive
C++ dependencies in the same C++ domain visible too.

Assisted-by: Gemini via Antigravity
This commit is contained in:
Richard Smith
2026-08-06 13:32:37 +00:00
committed by GitHub
parent b9692a0e77
commit a1e843718e
19 changed files with 324 additions and 164 deletions
+3 -2
View File
@@ -14,11 +14,12 @@ namespace Carbon::SemIR {
CppFile::CppFile(std::shared_ptr<clang::CompilerInstance> clang,
std::unique_ptr<clang::MangleContext> mangle_context,
llvm::LLVMContext* llvm_context,
clang::CodeGenerator* code_generator)
clang::CodeGenerator* code_generator, CppDomain* cpp_domain)
: clang_(std::move(clang)),
mangle_context_(std::move(mangle_context)),
llvm_context_(llvm_context),
code_generator_(code_generator) {}
code_generator_(code_generator),
cpp_domain_(cpp_domain) {}
CppFile::~CppFile() = default;