[clang] [clang-tools-extra] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 27 15:43:05 PDT 2025
================
@@ -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(
----------------
YexuanXiao wrote:
This function is used by TypeProperties.td and may not support `enum`s, similar to other definitions in same file. I recall attempting to use `enum`s before but failing.
https://github.com/llvm/llvm-project/pull/143653
More information about the cfe-commits
mailing list