[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
================
@@ -8038,6 +8060,32 @@ class DependentBitIntType final : public Type, public llvm::FoldingSetNode {
}
};
+class PredefinedSugarType final : public Type {
+public:
+ friend class ASTContext;
+ using Kind = PredefinedSugarKind;
+
+private:
+ PredefinedSugarType(Kind KD, QualType UnderlyingType)
+ : Type(PredefinedSugar, UnderlyingType->getCanonicalTypeInternal(),
+ TypeDependence::None) {
+ PredefinedSugarTypeBits.Kind = llvm::to_underlying(KD);
+ }
+
+public:
+ bool isSugared() const { return true; }
+
+ QualType desugar() const { return getCanonicalTypeInternal(); }
+
+ Kind getKind() const { return Kind(PredefinedSugarTypeBits.Kind); }
+
+ StringRef getName() const;
----------------
mizvekov wrote:
It might be worthwhile to consider returning an IdentifierInfo. These are uniqued, which makes it cheaper to compare them, and it increases commonality with other code that deals with these identifiers.
https://github.com/llvm/llvm-project/pull/143653
More information about the cfe-commits
mailing list