@@ -141,4 +141,37 @@ def CIR_AnyIntOrFloatType : AnyTypeOf<[CIR_AnyFloatType, CIR_AnyIntType],
141141 let cppFunctionName = "isAnyIntegerOrFloatingPointType";
142142}
143143
144+ //===----------------------------------------------------------------------===//
145+ // Pointer Type predicates
146+ //===----------------------------------------------------------------------===//
147+
148+ def CIR_AnyPtrType : CIR_TypeBase<"::cir::PointerType", "pointer type">;
149+
150+ // Pointer to type constraint bases
151+ class CIR_IsPtrToPred<code type> : CPred<"$_self.isPtrTo<" # type # ">()">;
152+
153+ class CIR_PtrTo<code type, string summary>
154+ : CIR_ConfinedType<CIR_AnyPtrType, [CIR_IsPtrToPred<type>],
155+ "pointer to " # summary>;
156+
157+ // Pointer to pointer constraint bases
158+ class CIR_IsPtrToPtrToPred<code type>
159+ : CPred<"$_self.isPtrToPtrTo<" # type # ">()">;
160+
161+ class CIR_PtrToPtrTo<code type, string summary>
162+ : CIR_ConfinedType<CIR_AnyPtrType, [CIR_IsPtrToPtrToPred<type>],
163+ "pointer to pointer to " # summary>;
164+
165+ // Void pointer type constraints
166+ def CIR_VoidPtrType
167+ : CIR_PtrTo<"::cir::VoidType", "void type">,
168+ BuildableType<"$_builder.getType<" # cppType # ">("
169+ "cir::VoidType::get($_builder.getContext()))">;
170+
171+ def CIR_PtrToVoidPtrType
172+ : CIR_PtrToPtrTo<"::cir::VoidType", "void type">,
173+ BuildableType<"$_builder.getType<" # cppType # ">("
174+ "$_builder.getType<" # cppType # ">("
175+ "cir::VoidType::get($_builder.getContext())))">;
176+
144177#endif // CLANG_CIR_DIALECT_IR_CIRTYPECONSTRAINTS_TD
0 commit comments