On 03/12/2013 04:10 PM, Bill Wendling wrote:
Hi Reed,

This is a lot of code just to add one function attribute (not your fault, but mine). 
Instead of generating an AttrBuilder etc., could you add a convenience function to the 
Function and AttributeSet objects that add a string attribute --- it would be very 
similar to how Attribute::AttrKinds are currently added. That would clean up this code 
quite nicely. Of course, if you end up adding a lot of attributes in this method, then 
you'll want to revert to using the "AttrBuilder" for that.

As for the code itself, you might want to use an early exit like this:

   const FunctionDecl *FD = dyn_cast<FunctionDecl>(D);
   if (!FD) return;

   // Code that sets the attributes ...

-bw
and


  /// \brief Add attributes to the attribute set at the given index. Since
  /// attribute sets are immutable, this returns a new set.
  AttributeSet addAttribute(LLVMContext &C, unsigned Idx,
                             StringRef Kind) const;



On Mar 12, 2013, at 1:44 PM, Reed Kotler <[email protected]> wrote:

Use the new attribute scheme to pass mips16/nomips16 attributes from clang to 
llvm


<mips16_attrn.txt>


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to