================ @@ -4884,6 +4884,72 @@ class DependentDecltypeType : public DecltypeType, public llvm::FoldingSetNode { Expr *E); }; +class PackIndexingType final + : public Type, + public llvm::FoldingSetNode, + private llvm::TrailingObjects<PackIndexingType, QualType> { + friend TrailingObjects; + + const ASTContext &Context; + QualType Pattern; + Expr *IndexExpr; + + unsigned Size; + int Index = -1; + +protected: + friend class ASTContext; // ASTContext creates these. + PackIndexingType(const ASTContext &Context, QualType Canonical, + QualType Pattern, Expr *IndexExpr, + ArrayRef<QualType> Expansions = {}, int Index = -1); + +public: + Expr *getIndexExpr() const { return IndexExpr; } + QualType getPattern() const { return Pattern; } + + bool isSugared() const { return hasSelectedType(); } + + QualType desugar() const { + if (hasSelectedType()) + return getSelectedType(); + return QualType(this, 0); + } + + QualType getSelectedType() const { + assert(hasSelectedType() && "Type is dependant"); + return *(getExpansionsPtr() + Index); + } + + bool hasSelectedType() const { return Index != -1 && !isDependentType(); } ---------------- erichkeane wrote:
Shouldn't JUST the second part of this be sufficient? I would think that as soon as we're not dependent, the index should be 'set', correct? Or am I misunderstanding? https://github.com/llvm/llvm-project/pull/72644 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits