================ @@ -5216,6 +5237,25 @@ QualType ASTContext::getDependentBitIntType(bool IsUnsigned, return QualType(New, 0); } +QualType ASTContext::getPredefinedSugarType(uint32_t KD) const { + using Kind = PredefinedSugarType::Kind; + auto getUnderlyingType = [](const ASTContext &Ctx, Kind KDI) -> QualType { + switch (KDI) { + case Kind::SizeT: + return Ctx.getFromTargetType(Ctx.Target->getSizeType()); + case Kind::SignedSizeT: + return Ctx.getFromTargetType(Ctx.Target->getSignedSizeType()); + case Kind::PtrdiffT: + return Ctx.getFromTargetType(Ctx.Target->getPtrDiffType(LangAS::Default)); + } + llvm_unreachable("unexpected kind"); + }; + auto *New = new (*this, alignof(PredefinedSugarType)) PredefinedSugarType( + static_cast<Kind>(KD), getUnderlyingType(*this, static_cast<Kind>(KD))); ---------------- mizvekov wrote:
These should already be canonical types, right? ```suggestion auto getCanonicalType = [](const ASTContext &Ctx, Kind KDI) -> QualType { switch (KDI) { case Kind::SizeT: return Ctx.getFromTargetType(Ctx.Target->getSizeType()); case Kind::SignedSizeT: return Ctx.getFromTargetType(Ctx.Target->getSignedSizeType()); case Kind::PtrdiffT: return Ctx.getFromTargetType(Ctx.Target->getPtrDiffType(LangAS::Default)); } llvm_unreachable("unexpected kind"); }; auto *New = new (*this, alignof(PredefinedSugarType)) PredefinedSugarType( static_cast<Kind>(KD), getCanonicalType(*this, static_cast<Kind>(KD))); ``` https://github.com/llvm/llvm-project/pull/143653 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits