[clang] [clang-tools-extra] [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
Fri Jun 27 14:39:54 PDT 2025


================
@@ -14526,6 +14564,9 @@ static QualType getCommonSugarTypeNode(ASTContext &Ctx, const Type *X,
                                       DX->isCountInBytes(), DX->isOrNull(),
                                       CDX);
   }
+  case Type::PredefinedSugar:
+    // FIXME: Should this be reachable here?
+    return QualType();
----------------
mizvekov wrote:

```suggestion
  case Type::PredefinedSugar:
    assert(cast<PredefinedSugarType>(X)->getKind() != cast<PredefinedSugarType>(Y)->getKind());
    return QualType();
```

Yeah, this can be reached if you have two PredefinedTypes which have the same canonical type.

The assert is helpful because if you reach here and they have the same kind, that means we screwed up the uniquing and created two different PredefinedTypes with the same kind.

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


More information about the cfe-commits mailing list