================
@@ -498,6 +498,49 @@ def CIR_DataMemberAttr : CIR_Attr<"DataMember",
"data_member", [
}];
}
+//===----------------------------------------------------------------------===//
+// MethodAttr
+//===----------------------------------------------------------------------===//
+
+def CIR_MethodAttr : CIR_Attr<"Method", "method", [TypedAttrInterface]> {
+ let summary = "Holds a constant pointer-to-member-function value";
+ let description = [{
+ A method attribute is a literal attribute that represents a constant
+ pointer-to-member-function value.
+
+ If the member function is a non-virtual function, the `symbol` parameter
+ gives the global symbol for the non-virtual member function.
+
+ Virtual function handling is not yet implemented.
+
+ If `symbol` is not present, the attribute represents a null pointer
+ constant.
+ }];
+
+ let parameters = (ins AttributeSelfTypeParameter<
+ "", "cir::MethodType">:$type,
+ OptionalParameter<
+ "std::optional<mlir::FlatSymbolRefAttr>">:$symbol);
+
+ let builders = [
+ AttrBuilderWithInferredContext<(ins "cir::MethodType":$type), [{
+ return $_get(type.getContext(), type, std::nullopt);
+ }]>,
+ AttrBuilderWithInferredContext<(ins "cir::MethodType":$type,
+ "mlir::FlatSymbolRefAttr":$symbol), [{
+ return $_get(type.getContext(), type, symbol);
+ }]>,
+ ];
+
+ let hasCustomAssemblyFormat = 1;
----------------
xlauko wrote:
Do we really need to have hasCustomAssemblyFormat for this? It seems to be
required only for that custom `null`? I agree with @erichkeane that this can be
represented just by no presence of attribute no?
https://github.com/llvm/llvm-project/pull/174640
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits