[clang] [Serialization] [ASTWriter] Try to not record namespace as much as possible (PR #179178)

via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 12 01:53:49 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,h,cppm -- clang/test/Modules/no-transitive-change-namespace.cppm clang/test/Modules/pr184957.cppm clang/include/clang/Serialization/ASTWriter.h clang/lib/Serialization/ASTWriter.cpp clang/lib/Serialization/ASTWriterDecl.cpp clang/test/Modules/no-transitive-decl-change-4.cppm --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/Serialization/ASTWriterDecl.cpp b/clang/lib/Serialization/ASTWriterDecl.cpp
index d2fb6f9e8..62c6353a3 100644
--- a/clang/lib/Serialization/ASTWriterDecl.cpp
+++ b/clang/lib/Serialization/ASTWriterDecl.cpp
@@ -2239,7 +2239,7 @@ void ASTDeclWriter::VisitRedeclarable(Redeclarable<T> *D) {
         // 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);
+          AddFirstDeclFromEachModule(DAsT, /*IncludeLocal=*/false);
         else
           Record.AddDeclRef(/*Decl=*/nullptr);
       }

``````````

</details>


https://github.com/llvm/llvm-project/pull/179178


More information about the cfe-commits mailing list