[clang] [Serialization] Stop demote var definition as declaration (#172430) (#177117) (PR #184287)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 2 19:32:21 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/demote-var-def.cpp clang/test/Modules/module-init-forcelly-loaded-module.cpp clang/test/Modules/pr149404-02.cppm clang/test/Modules/pr172241.cppm clang/test/Modules/var-inst-def.cppm clang/lib/Sema/SemaType.cpp clang/lib/Serialization/ASTReaderDecl.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/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp
index a9c3751df..6406ee06e 100644
--- a/clang/lib/Sema/SemaType.cpp
+++ b/clang/lib/Sema/SemaType.cpp
@@ -9495,7 +9495,7 @@ bool Sema::hasAcceptableDefinition(NamedDecl *D, NamedDecl **Suggested,
auto FoundAcceptableDefinition = [&](NamedDecl *D) {
if (!isa<CXXRecordDecl, FunctionDecl, EnumDecl, VarDecl>(D))
return DefinitionIsAcceptable(D);
-
+
// See ASTDeclReader::attachPreviousDeclImpl. Now we still
// may demote definition to declaration for decls in haeder modules,
// so avoid looking at its redeclaration to save time.
diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp
index b49bd5ea8..e0eb6b861 100644
--- a/clang/lib/Serialization/ASTReaderDecl.cpp
+++ b/clang/lib/Serialization/ASTReaderDecl.cpp
@@ -3638,7 +3638,7 @@ void ASTDeclReader::attachPreviousDeclImpl(ASTReader &Reader,
namespace clang {
-template<>
+template <>
void ASTDeclReader::attachPreviousDeclImpl(ASTReader &Reader,
Redeclarable<VarDecl> *D,
Decl *Previous, Decl *Canon) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/184287
More information about the cfe-commits
mailing list