[clang] [C++20][Modules][NFC] Some minor comment fixes (PR #172524)
Michael Park via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 16 09:51:01 PST 2025
https://github.com/mpark updated https://github.com/llvm/llvm-project/pull/172524
>From c30337da103da8abc5c08662039ec12163d05b1c Mon Sep 17 00:00:00 2001
From: Michael Park <mcypark at gmail.com>
Date: Tue, 16 Dec 2025 09:30:18 -0800
Subject: [PATCH 1/3] [C++20][Modules][NFC] Fix typo in ASTWriter.cpp.
---
clang/lib/Serialization/ASTWriter.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index 899fd69c2045e..0638f2c4efbe8 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -4641,7 +4641,7 @@ uint64_t ASTWriter::WriteSpecializationInfoLookupTable(
return Offset;
}
-/// Returns ture if all of the lookup result are either external, not emitted or
+/// Returns true if all of the lookup result are either external, not emitted or
/// predefined. In such cases, the lookup result is not interesting and we don't
/// need to record the result in the current being written module. Return false
/// otherwise.
>From 28555c72b2434d041f6a4ad95efaa43ebf48c308 Mon Sep 17 00:00:00 2001
From: Michael Park <mcypark at gmail.com>
Date: Tue, 16 Dec 2025 09:30:25 -0800
Subject: [PATCH 2/3] [C++20][Modules][NFC] Fix incorrect comment in modules
reachability test.
---
clang/test/CXX/module/module.reach/p5.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/test/CXX/module/module.reach/p5.cpp b/clang/test/CXX/module/module.reach/p5.cpp
index 947fd082553ec..f977049f2e996 100644
--- a/clang/test/CXX/module/module.reach/p5.cpp
+++ b/clang/test/CXX/module/module.reach/p5.cpp
@@ -13,5 +13,5 @@ export using Y = X;
//--- B.cppm
export module B;
import A;
-Y y; // OK, definition of X is reachable
+Y y; // OK, definition of Y is reachable
X x; // expected-error {{unknown type name 'X'}}
>From 56089c77198b5962c486ba87512c9c275a01e09f Mon Sep 17 00:00:00 2001
From: Michael Park <mcypark at gmail.com>
Date: Tue, 16 Dec 2025 09:50:28 -0800
Subject: [PATCH 3/3] [C++20][Modules][NFC] Pull the chain access out of the
loop.
---
clang/lib/Serialization/ASTWriter.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index 0638f2c4efbe8..317ba8679db5d 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -4441,9 +4441,9 @@ class ASTDeclContextNameLookupTrait
DeclIDs.push_back(ID);
};
+ ASTReader *Chain = Writer.getChain();
for (NamedDecl *D : Decls) {
- if (ASTReader *Chain = Writer.getChain();
- Chain && isa<NamespaceDecl>(D) && D->isFromASTFile() &&
+ if (Chain && isa<NamespaceDecl>(D) && D->isFromASTFile() &&
D == Chain->getKeyDeclaration(D)) {
// In ASTReader, we stored only the key declaration of a namespace decl
// for this TU rather than storing all of the key declarations from each
More information about the cfe-commits
mailing list