================
@@ -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(
----------------
mizvekov wrote:

I'd have a preference to unique the types here, instead of relying on us only 
calling this once and storing these on ad-hoc named members of ASTContext, just 
because its harder to make mistakes.

https://github.com/llvm/llvm-project/pull/143653
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to