[clang] [Serialization] [ASTWriter] Try to not record namespace as much as possible (PR #179178)
Shafik Yaghmour via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 4 22:07:57 PST 2026
================
@@ -2234,8 +2234,15 @@ void ASTDeclWriter::VisitRedeclarable(Redeclarable<T> *D) {
// redecl chain.
unsigned I = Record.size();
Record.push_back(0);
- if (Writer.Chain)
- AddFirstDeclFromEachModule(DAsT, /*IncludeLocal*/false);
+ if (Writer.Chain) {
+ // Namespace can have many redeclaration in many TU.
+ // We try to avoid touching every redeclaration to try to
+ // reduce the dependencies as much as possible.
+ if (!isa<NamespaceDecl>(DAsT))
+ AddFirstDeclFromEachModule(DAsT, /*IncludeLocal*/ false);
----------------
shafik wrote:
```suggestion
AddFirstDeclFromEachModule(DAsT, /*IncludeLocal=*/false);
```
https://github.com/llvm/llvm-project/pull/179178
More information about the cfe-commits
mailing list