[clang] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 27 12:13:02 PST 2024


================
@@ -13233,6 +13262,32 @@ static QualType getCommonSugarTypeNode(ASTContext &Ctx, const Type *X,
       return QualType();
     return Ctx.getUsingType(CD, Ctx.getQualifiedType(Underlying));
   }
+  case Type::CountAttributed: {
+    const auto *DX = cast<CountAttributedType>(X),
+               *DY = cast<CountAttributedType>(Y);
+    if (DX->isCountInBytes() != DY->isCountInBytes())
+      return QualType();
+    if (DX->isOrNull() != DY->isOrNull())
+      return QualType();
+    const auto CEX = DX->getCountExpr();
+    const auto CEY = DY->getCountExpr();
+    const auto CDX = DX->getCoupledDecls();
----------------
AaronBallman wrote:

You should spell these types out (same below) because the type is not in the initializer.

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


More information about the cfe-commits mailing list