<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 07/09/2015 07:06 PM, Tarun Prabhu
wrote:<br>
</div>
<blockquote
cite="mid:CAJcUrT2c-3_Ki7_fMT5cxwOuRCsW+8FRiH5PZO=+45JvN9oQ6Q@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>Hello,</div>
<div><br>
</div>
I am trying to add custom attributes to function arguments. I
can add them using Argument->addAttr().
<div><br>
</div>
<div>| AttrBuilder attrbuilder;<br>
</div>
<div>
<div>| Attribute attr = Attribute::get(context, "attrname",
"attrval");</div>
<div>| attrBuilder.addAttribute(attr);<br>
</div>
<div>| arg->addAttr(AttributeSet::get(context, 0,
attrBuilder));</div>
</div>
<div><br>
</div>
<div>But I can't find a way to check if a Argument has attribute
"attrname". <br>
</div>
<div>
<div><br>
</div>
<div>You can do this for functions with
addFnAttribute("attrname", "attrval"), and then query it
with hasFnAttribute("attrname"). </div>
</div>
<div><br>
</div>
<div>Is there a similar API for Arguments which, for some
reason, doesn't appear in the documentation? <br>
</div>
</div>
</blockquote>
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. <br>
<br>
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. <br>
<br>
<br>
<blockquote
cite="mid:CAJcUrT2c-3_Ki7_fMT5cxwOuRCsW+8FRiH5PZO=+45JvN9oQ6Q@mail.gmail.com"
type="cite">
<div dir="ltr">
<div><br>
</div>
<div>Thanks,<br>
</div>
<div><br>
</div>
<div>Tarun</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a class="moz-txt-link-freetext" href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a>
<a class="moz-txt-link-freetext" href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a>
</pre>
</blockquote>
<br>
</body>
</html>