@@ -413,9 +413,11 @@ class SubstTemplateTemplateParmStorage
413413
414414 SubstTemplateTemplateParmStorage (TemplateName Replacement,
415415 Decl *AssociatedDecl, unsigned Index,
416- std::optional<unsigned > PackIndex)
416+ std::optional<unsigned > PackIndex,
417+ bool Final)
417418 : UncommonTemplateNameStorage(SubstTemplateTemplateParm, Index,
418- PackIndex ? *PackIndex + 1 : 0 ),
419+ ((PackIndex ? *PackIndex + 1 : 0 ) << 1 ) |
420+ Final),
419421 Replacement (Replacement), AssociatedDecl(AssociatedDecl) {
420422 assert (AssociatedDecl != nullptr );
421423 }
@@ -429,10 +431,15 @@ class SubstTemplateTemplateParmStorage
429431 // / This should match the result of `getParameter()->getIndex()`.
430432 unsigned getIndex () const { return Bits.Index ; }
431433
434+ // This substitution is Final, which means the substitution is fully
435+ // sugared: it doesn't need to be resugared later.
436+ bool getFinal () const { return Bits.Data & 1 ; }
437+
432438 std::optional<unsigned > getPackIndex () const {
433- if (Bits.Data == 0 )
439+ auto Data = Bits.Data >> 1 ;
440+ if (Data == 0 )
434441 return std::nullopt ;
435- return Bits. Data - 1 ;
442+ return Data - 1 ;
436443 }
437444
438445 TemplateTemplateParmDecl *getParameter () const ;
@@ -442,7 +449,7 @@ class SubstTemplateTemplateParmStorage
442449
443450 static void Profile (llvm::FoldingSetNodeID &ID, TemplateName Replacement,
444451 Decl *AssociatedDecl, unsigned Index,
445- std::optional<unsigned > PackIndex);
452+ std::optional<unsigned > PackIndex, bool Final );
446453};
447454
448455class DeducedTemplateStorage : public UncommonTemplateNameStorage ,
0 commit comments