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

Matheus Izvekov via libcxx-commits libcxx-commits at lists.llvm.org
Sat Jun 28 19:12:16 PDT 2025


================
@@ -5216,6 +5230,38 @@ QualType ASTContext::getDependentBitIntType(bool IsUnsigned,
   return QualType(New, 0);
 }
 
+QualType
+ASTContext::getPredefinedSugarType(PredefinedSugarType::Kind KD) const {
+  llvm::FoldingSetNodeID ID;
+  PredefinedSugarType::Profile(ID, llvm::to_underlying(KD));
+
+  void *InsertPos = nullptr;
+  if (PredefinedSugarType *Existing =
+          PredefinedSugarTypes.FindNodeOrInsertPos(ID, InsertPos))
+    return QualType(Existing, 0);
----------------
mizvekov wrote:

I mentioned this in another comment, but it's a waste to use a hash table to unique a set with only 3 possible elements. You could just use an array instead.

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


More information about the libcxx-commits mailing list