@@ -1802,6 +1802,15 @@ enum class AutoTypeKeyword {
18021802 GNUAutoType
18031803};
18041804
1805+ enum class SubstTemplateTypeParmTypeFlag {
1806+ None,
1807+
1808+ // / Whether to expand the pack using the stored PackIndex in place. This is
1809+ // / useful for e.g. substituting into an atomic constraint expression, where
1810+ // / that expression is part of an unexpanded pack.
1811+ ExpandPacksInPlace,
1812+ };
1813+
18051814enum class ArraySizeModifier ;
18061815enum class ElaboratedTypeKeyword ;
18071816enum class VectorKind ;
@@ -2171,6 +2180,9 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase {
21712180 LLVM_PREFERRED_TYPE (bool )
21722181 unsigned HasNonCanonicalUnderlyingType : 1 ;
21732182
2183+ LLVM_PREFERRED_TYPE (SubstTemplateTypeParmTypeFlag)
2184+ unsigned SubstitutionFlag : 1 ;
2185+
21742186 // The index of the template parameter this substitution represents.
21752187 unsigned Index : 15 ;
21762188
@@ -6387,7 +6399,8 @@ class SubstTemplateTypeParmType final
63876399 Decl *AssociatedDecl;
63886400
63896401 SubstTemplateTypeParmType (QualType Replacement, Decl *AssociatedDecl,
6390- unsigned Index, std::optional<unsigned > PackIndex);
6402+ unsigned Index, std::optional<unsigned > PackIndex,
6403+ SubstTemplateTypeParmTypeFlag Flag);
63916404
63926405public:
63936406 // / Gets the type that was substituted for the template
@@ -6416,21 +6429,31 @@ class SubstTemplateTypeParmType final
64166429 return SubstTemplateTypeParmTypeBits.PackIndex - 1 ;
64176430 }
64186431
6432+ SubstTemplateTypeParmTypeFlag getSubstitutionFlag () const {
6433+ return static_cast <SubstTemplateTypeParmTypeFlag>(
6434+ SubstTemplateTypeParmTypeBits.SubstitutionFlag );
6435+ }
6436+
64196437 bool isSugared () const { return true ; }
64206438 QualType desugar () const { return getReplacementType (); }
64216439
64226440 void Profile (llvm::FoldingSetNodeID &ID) {
64236441 Profile (ID, getReplacementType (), getAssociatedDecl (), getIndex (),
6424- getPackIndex ());
6442+ getPackIndex (), getSubstitutionFlag () );
64256443 }
64266444
64276445 static void Profile (llvm::FoldingSetNodeID &ID, QualType Replacement,
64286446 const Decl *AssociatedDecl, unsigned Index,
6429- std::optional<unsigned > PackIndex) {
6447+ std::optional<unsigned > PackIndex,
6448+ SubstTemplateTypeParmTypeFlag Flag) {
64306449 Replacement.Profile (ID);
64316450 ID.AddPointer (AssociatedDecl);
64326451 ID.AddInteger (Index);
64336452 ID.AddInteger (PackIndex ? *PackIndex - 1 : 0 );
6453+ ID.AddInteger (llvm::to_underlying (Flag));
6454+ assert ((Flag != SubstTemplateTypeParmTypeFlag::ExpandPacksInPlace ||
6455+ PackIndex) &&
6456+ " ExpandPacksInPlace needs a valid PackIndex" );
64346457 }
64356458
64366459 static bool classof (const Type *T) {
0 commit comments