Use a single llvm::Module for C++ interop and Carbon IRGen (#6595)

Some module metadata changed - because rather than linking one module
with one module metadata value (eg: PIC Level 0, or unspecified) and one
module with a different one (PIC level 2, in clang) - we use Clang's
Module as-is, no merging required, so Clang's module metadata sticks
rather than being merged with default values from Carbon.

Also tweaked the name we use for Clang's module name so it matches the
carbon file name.

Otherwise the IR changes seem to be just reorderings - C++ interop goes
first, then Carbon, rather than the other way around.
This commit is contained in:
David Blaikie
2026-01-17 00:15:53 +00:00
committed by GitHub
parent 83aeddb5ec
commit 773b7136ef
26 changed files with 2061 additions and 2031 deletions
+2 -2
View File
@@ -339,7 +339,7 @@ class GenerateASTAction : public clang::ASTFrontendAction {
protected:
auto CreateASTConsumer(clang::CompilerInstance& clang_instance,
llvm::StringRef file)
llvm::StringRef /*file*/)
-> std::unique_ptr<clang::ASTConsumer> override {
auto& cpp_file = *context_->sem_ir().cpp_file();
if (!cpp_file.llvm_context()) {
@@ -347,7 +347,7 @@ class GenerateASTAction : public clang::ASTFrontendAction {
}
auto code_generator =
std::unique_ptr<clang::CodeGenerator>(clang::CreateLLVMCodeGen(
cpp_file.diagnostics(), file,
cpp_file.diagnostics(), context_->sem_ir().filename(),
clang_instance.getVirtualFileSystemPtr(),
clang_instance.getHeaderSearchOpts(),
clang_instance.getPreprocessorOpts(),