[LLVMdev] Question about changes to llvm::Argument::addAttr(AttributeSet AS) API

Christian Schafmeister chris.schaf at verizon.net
Wed Jan 30 20:20:38 PST 2013


I recently upgraded to the latest LLVM build and encountered a problem where the API for Argument::addAttr has changed.

Previously it was Argument::addAttr(Attribute A) and I was able to work with this.

The latest build has changed the method addAttr so that it requires an AttributeSet argument (Argument::addAttr(AttributeSet AS).

I'm not sure how to adjust to this change. The AttributeSet object seems to store an array of Attribute(s) to construct an AttributeSet argument for addAttr I need to know the index of the Argument in the function?

I can follow the lead of this code from Core.cpp:

void LLVMAddAttribute(LLVMValueRef Arg, LLVMAttribute PA) {
  Argument *A = unwrap<Argument>(Arg);
  AttrBuilder B(PA);
  A->addAttr(AttributeSet::get(A->getContext(), A->getArgNo() + 1,  B));

Is this all I need?  What does the A->getArgNo()+1 provide? The index of the argument in the function argument list+1?

Is this change to the API described anywhere?



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130130/bc202cf3/attachment.html>

More information about the llvm-dev mailing list