[clang] [clang][Sema] Fix initialization of `NonTypeTemplateParmDecl`... (PR #121768)
Younan Zhang via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 20 00:30:22 PST 2025
Alejandro =?utf-8?q?Álvarez_Ayllón?=,
Alejandro =?utf-8?q?Álvarez_Ayllón?=,
Alejandro =?utf-8?q?Álvarez_Ayllón?=,
Alejandro =?utf-8?q?Álvarez_Ayllón?Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/121768 at github.com>
================
@@ -1983,15 +1983,17 @@ void ASTDeclWriter::VisitNonTypeTemplateParmDecl(NonTypeTemplateParmDecl *D) {
// For an expanded parameter pack, record the number of expansion types here
// so that it's easier for deserialization to allocate the right amount of
// memory.
- Expr *TypeConstraint = D->getPlaceholderTypeConstraint();
- Record.push_back(!!TypeConstraint);
+ Record.push_back(D->hasPlaceholderTypeConstraint());
if (D->isExpandedParameterPack())
Record.push_back(D->getNumExpansionTypes());
VisitDeclaratorDecl(D);
// TemplateParmPosition.
Record.push_back(D->getDepth());
Record.push_back(D->getPosition());
+ Expr *TypeConstraint = D->getPlaceholderTypeConstraint();
+ Record.push_back(/*PlaceholderTypeConstraintInitialized=*/TypeConstraint !=
+ nullptr);
----------------
zyn0217 wrote:
Can we only serialize `PlaceholderTypeConstraintInitialized` only when `D->hasPlaceholderTypeConstraint()` so that we can save up a bit for a number of cases?
https://github.com/llvm/llvm-project/pull/121768
More information about the cfe-commits
mailing list