[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:22:53 PDT 2025


================
@@ -2258,6 +2258,27 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase {
     unsigned NumExpansions;
   };
 
+  enum class PredefinedSugarKind {
+    /// The "size_t" type.
+    SizeT,
+
+    /// The "signed size_t" type.
----------------
YexuanXiao wrote:

@frederick-vs-ja [mentioned in the comment above](https://github.com/llvm/llvm-project/pull/143653#discussion_r2141546366) that POSIX does not require the `typedef` `ssize_t` to be the `signed` version of `size_t`. At the same time, the C and C++ standards also do not require the `typedef` `ptrdiff_t` to be the `signed` version of `size_t`. I am not sure whether there actually exist platforms with such inconsistencies, but perhaps it should not be confused?

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


More information about the cfe-commits mailing list