[LLVMdev] Adding/checking an attribute to function argument

Tarun Prabhu tarunprabhu at gmail.com
Thu Jul 9 19:06:57 PDT 2015


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150709/863df909/attachment.html>


More information about the llvm-dev mailing list