+//===----------------------------------------------------------------------===//
+/// \class
+/// \brief This is just a pair of values to associate a set of attributes with
+/// an index.
+struct AttributeWithIndex {
+ Attribute Attrs; ///< The attributes that are set, or'd together.
+ Constant *Val; ///< Value attached to attribute, e.g. alignment.
+ unsigned Index; ///< Index of the parameter for which the attributes apply.
+ ///< Index 0 is used for return value attributes.
+ ///< Index ~0U is used for function attributes.
+
+ // FIXME: These methods all need to be revised. The first one is temporary.
+ static AttributeWithIndex get(LLVMContext &C, unsigned Idx, AttributeSet AS);
+ static AttributeWithIndex get(LLVMContext &C, unsigned Idx,
+ ArrayRef<Attribute::AttrKind> Attrs) {
+ return get(Idx, Attribute::get(C, Attrs));
+ }
+ static AttributeWithIndex get(unsigned Idx, Attribute Attrs) {
+ AttributeWithIndex P;
+ P.Index = Idx;
+ P.Attrs = Attrs;
+ P.Val = 0;
+ return P;
+ }
+ static AttributeWithIndex get(unsigned Idx, Attribute Attrs, Constant *Val) {
+ AttributeWithIndex P;
+ P.Index = Idx;
+ P.Attrs = Attrs;
+ P.Val = Val;
+ return P;
+ }
+};
+