Adding/checking an attribute to function argument

Hello,

I am trying to add custom attributes to function arguments. I can add them using Argument->addAttr().

AttrBuilder attrbuilder;

Attribute attr = Attribute::get(context, “attrname”, “attrval”);
attrBuilder.addAttribute(attr);

arg->addAttr(AttributeSet::get(context, 0, attrBuilder));

But I can’t find a way to check if a Argument has attribute “attrname”.

You can do this for functions with addFnAttribute(“attrname”, “attrval”), and then query it with hasFnAttribute(“attrname”).

Is there a similar API for Arguments which, for some reason, doesn’t appear in the documentation?

Thanks,

Tarun

See the discussion happening under the title “String attributes for function arguments and return values”. If I’m reading your question correctly, that’s exactly what you’re asking about. API wise, you need to get the attribute set from the function and look at the i+1 index to see if the attribute exists. It’s a bit of a mess, but that’s the current way to do so.