[clang] [C++20] [Modules] Don't update MarkAsUsed information for decls from named modules (PR #174687)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 6 18:57:10 PST 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 cppm,cpp -- clang/test/Modules/class-instantiate-no-change.cppm clang/lib/Serialization/ASTWriter.cpp --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/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index a211e9866..a6d85600f 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -7769,8 +7769,10 @@ void ASTWriter::DeclarationMarkedUsed(const Decl *D) {
if (Chain && Chain->isProcessingUpdateRecords()) return;
assert(!WritingAST && "Already writing the AST!");
- // If the declaration comes from module unit, it is meaningless to mark it as used.
- if (auto *M = D->getOwningModule(); M && M->getTopLevelModule()->isNamedModule())
+ // If the declaration comes from module unit, it is meaningless to mark it as
+ // used.
+ if (auto *M = D->getOwningModule();
+ M && M->getTopLevelModule()->isNamedModule())
return;
// If there is *any* declaration of the entity that's not from an AST file,
``````````
</details>
https://github.com/llvm/llvm-project/pull/174687
More information about the cfe-commits
mailing list