Create a Clang module per Carbon file. (#7594)

This isolates the C++ imports in different Carbon files from each other
in `--share-cpp-ast` mode, so that a Carbon file can only see the
portions of the shared Clang `ASTContext` that it actually imported.

Assisted-by: Gemini via Antigravity
This commit is contained in:
Richard Smith
2026-07-31 22:43:56 +00:00
committed by GitHub
parent a5f3d45717
commit 46b5482bb4
7 changed files with 187 additions and 77 deletions
+4
View File
@@ -100,6 +100,10 @@ auto BuildClangInvocation(Diagnostics::Consumer& consumer,
}
if (invocation) {
// Track submodule visibility in the preprocessor and Sema.
invocation->getLangOpts().Modules = true;
invocation->getLangOpts().ModulesLocalVisibility = true;
// Do not emit Clang's name and version as the creator of the output file.
invocation->getCodeGenOpts().EmitVersionIdentMetadata = false;
invocation->getCodeGenOpts().DiscardValueNames = false;