[clang] [Clang] Make the SizeType, SignedSizeType and PtrdiffType be named sugar types instead of built-in types (PR #143653)

Matheus Izvekov via cfe-commits cfe-commits at lists.llvm.org
Sat Jun 14 00:42:31 PDT 2025


================
@@ -8054,6 +8054,41 @@ class DependentBitIntType final : public Type, public llvm::FoldingSetNode {
   }
 };
 
+class PredefinedSugarType final : public Type {
+public:
+  enum Kind { SizeT, SignedSizeT, PtrdiffT };
+  friend class ASTContext;
+
+private:
+  Kind K;
+  QualType Underlying;
----------------
mizvekov wrote:

1) I don't think you need to store an Underlying type, as that is going to be canonical for the applications we have. If we later come up with an application where that's not the case, we can always add it back, preferably by tail allocating it.

2) You can store Kind in the freespace of the type bit fields. See TypedefTypeBitfields and friends for an example.

https://github.com/llvm/llvm-project/pull/143653


More information about the cfe-commits mailing list