Make sure attribute kind and attributes are named respectively Kind and Attr consistently. Historically they used to be the same the terminology is very confused in the codebase. NFC.

llvm-svn: 272704
This commit is contained in:
Amaury Sechet 2016-06-14 20:27:35 +00:00
parent d7e8206b58
commit 392638d7b1
7 changed files with 89 additions and 99 deletions

View File

@ -242,20 +242,18 @@ public:
/// \brief Return an AttributeSet with the specified parameters in it. /// \brief Return an AttributeSet with the specified parameters in it.
static AttributeSet get(LLVMContext &C, ArrayRef<AttributeSet> Attrs); static AttributeSet get(LLVMContext &C, ArrayRef<AttributeSet> Attrs);
static AttributeSet get(LLVMContext &C, unsigned Index, static AttributeSet get(LLVMContext &C, unsigned Index,
ArrayRef<Attribute::AttrKind> Kind); ArrayRef<Attribute::AttrKind> Kinds);
static AttributeSet get(LLVMContext &C, unsigned Index, const AttrBuilder &B); static AttributeSet get(LLVMContext &C, unsigned Index, const AttrBuilder &B);
/// \brief Add an attribute to the attribute set at the given index. Because /// \brief Add an attribute to the attribute set at the given index. Because
/// attribute sets are immutable, this returns a new set. /// attribute sets are immutable, this returns a new set.
AttributeSet addAttribute(LLVMContext &C, unsigned Index, AttributeSet addAttribute(LLVMContext &C, unsigned Index,
Attribute::AttrKind Attr) const; Attribute::AttrKind Kind) const;
/// \brief Add an attribute to the attribute set at the given index. Because /// \brief Add an attribute to the attribute set at the given index. Because
/// attribute sets are immutable, this returns a new set. /// attribute sets are immutable, this returns a new set.
AttributeSet addAttribute(LLVMContext &C, unsigned Index, AttributeSet addAttribute(LLVMContext &C, unsigned Index, StringRef Kind,
StringRef Kind) const; StringRef Value = StringRef()) const;
AttributeSet addAttribute(LLVMContext &C, unsigned Index,
StringRef Kind, StringRef Value) const;
/// Add an attribute to the attribute set at the given indices. Because /// Add an attribute to the attribute set at the given indices. Because
/// attribute sets are immutable, this returns a new set. /// attribute sets are immutable, this returns a new set.
@ -271,7 +269,7 @@ public:
/// attribute list. Because attribute lists are immutable, this returns the /// attribute list. Because attribute lists are immutable, this returns the
/// new list. /// new list.
AttributeSet removeAttribute(LLVMContext &C, unsigned Index, AttributeSet removeAttribute(LLVMContext &C, unsigned Index,
Attribute::AttrKind Attr) const; Attribute::AttrKind Kind) const;
/// \brief Remove the specified attributes at the specified index from this /// \brief Remove the specified attributes at the specified index from this
/// attribute list. Because attribute lists are immutable, this returns the /// attribute list. Because attribute lists are immutable, this returns the
@ -333,7 +331,7 @@ public:
/// \brief Return true if the specified attribute is set for at least one /// \brief Return true if the specified attribute is set for at least one
/// parameter or for the return value. /// parameter or for the return value.
bool hasAttrSomewhere(Attribute::AttrKind Attr) const; bool hasAttrSomewhere(Attribute::AttrKind Kind) const;
/// \brief Return the attribute object that exists at the given index. /// \brief Return the attribute object that exists at the given index.
Attribute getAttribute(unsigned Index, Attribute::AttrKind Kind) const; Attribute getAttribute(unsigned Index, Attribute::AttrKind Kind) const;

View File

@ -305,35 +305,35 @@ public:
CALLSITE_DELEGATE_SETTER(setAttributes(PAL)); CALLSITE_DELEGATE_SETTER(setAttributes(PAL));
} }
void addAttribute(unsigned i, Attribute::AttrKind attr) { void addAttribute(unsigned i, Attribute::AttrKind Kind) {
CALLSITE_DELEGATE_SETTER(addAttribute(i, attr)); CALLSITE_DELEGATE_SETTER(addAttribute(i, Kind));
} }
void addAttribute(unsigned i, StringRef Kind, StringRef Value) { void addAttribute(unsigned i, StringRef Kind, StringRef Value) {
CALLSITE_DELEGATE_SETTER(addAttribute(i, Kind, Value)); CALLSITE_DELEGATE_SETTER(addAttribute(i, Kind, Value));
} }
void removeAttribute(unsigned i, Attribute::AttrKind attr) { void removeAttribute(unsigned i, Attribute::AttrKind Kind) {
CALLSITE_DELEGATE_SETTER(removeAttribute(i, attr)); CALLSITE_DELEGATE_SETTER(removeAttribute(i, Kind));
} }
void removeAttribute(unsigned i, Attribute attr) { void removeAttribute(unsigned i, Attribute Attr) {
CALLSITE_DELEGATE_SETTER(removeAttribute(i, attr)); CALLSITE_DELEGATE_SETTER(removeAttribute(i, Attr));
} }
/// \brief Return true if this function has the given attribute. /// \brief Return true if this function has the given attribute.
bool hasFnAttr(Attribute::AttrKind A) const { bool hasFnAttr(Attribute::AttrKind Kind) const {
CALLSITE_DELEGATE_GETTER(hasFnAttr(A)); CALLSITE_DELEGATE_GETTER(hasFnAttr(Kind));
} }
/// \brief Return true if this function has the given attribute. /// \brief Return true if this function has the given attribute.
bool hasFnAttr(StringRef A) const { bool hasFnAttr(StringRef Kind) const {
CALLSITE_DELEGATE_GETTER(hasFnAttr(A)); CALLSITE_DELEGATE_GETTER(hasFnAttr(Kind));
} }
/// \brief Return true if the call or the callee has the given attribute. /// \brief Return true if the call or the callee has the given attribute.
bool paramHasAttr(unsigned i, Attribute::AttrKind A) const { bool paramHasAttr(unsigned i, Attribute::AttrKind Kind) const {
CALLSITE_DELEGATE_GETTER(paramHasAttr(i, A)); CALLSITE_DELEGATE_GETTER(paramHasAttr(i, Kind));
} }
/// \brief Return true if the data operand at index \p i directly or /// \brief Return true if the data operand at index \p i directly or
@ -343,8 +343,8 @@ public:
/// in the attribute set attached to this instruction, while operand bundle /// in the attribute set attached to this instruction, while operand bundle
/// operands may have some attributes implied by the type of its containing /// operands may have some attributes implied by the type of its containing
/// operand bundle. /// operand bundle.
bool dataOperandHasImpliedAttr(unsigned i, Attribute::AttrKind A) const { bool dataOperandHasImpliedAttr(unsigned i, Attribute::AttrKind Kind) const {
CALLSITE_DELEGATE_GETTER(dataOperandHasImpliedAttr(i, A)); CALLSITE_DELEGATE_GETTER(dataOperandHasImpliedAttr(i, Kind));
} }
/// @brief Extract the alignment for a call or parameter (0=unknown). /// @brief Extract the alignment for a call or parameter (0=unknown).

View File

@ -163,7 +163,7 @@ public:
AttributeSet getAttributes() const { return AttributeSets; } AttributeSet getAttributes() const { return AttributeSets; }
/// @brief Set the attribute list for this Function. /// @brief Set the attribute list for this Function.
void setAttributes(AttributeSet attrs) { AttributeSets = attrs; } void setAttributes(AttributeSet Attrs) { AttributeSets = Attrs; }
/// @brief Add function attributes to this function. /// @brief Add function attributes to this function.
void addFnAttr(Attribute::AttrKind N) { void addFnAttr(Attribute::AttrKind N) {
@ -172,9 +172,9 @@ public:
} }
/// @brief Remove function attributes from this function. /// @brief Remove function attributes from this function.
void removeFnAttr(Attribute::AttrKind N) { void removeFnAttr(Attribute::AttrKind Kind) {
setAttributes(AttributeSets.removeAttribute( setAttributes(AttributeSets.removeAttribute(
getContext(), AttributeSet::FunctionIndex, N)); getContext(), AttributeSet::FunctionIndex, Kind));
} }
/// @brief Add function attributes to this function. /// @brief Add function attributes to this function.
@ -228,23 +228,23 @@ public:
void clearGC(); void clearGC();
/// @brief adds the attribute to the list of attributes. /// @brief adds the attribute to the list of attributes.
void addAttribute(unsigned i, Attribute::AttrKind attr); void addAttribute(unsigned i, Attribute::AttrKind Kind);
/// @brief adds the attribute to the list of attributes. /// @brief adds the attribute to the list of attributes.
void addAttribute(unsigned i, Attribute Attr); void addAttribute(unsigned i, Attribute Attr);
/// @brief adds the attributes to the list of attributes. /// @brief adds the attributes to the list of attributes.
void addAttributes(unsigned i, AttributeSet attrs); void addAttributes(unsigned i, AttributeSet Attrs);
/// @brief removes the attribute from the list of attributes. /// @brief removes the attribute from the list of attributes.
void removeAttribute(unsigned i, Attribute::AttrKind attr); void removeAttribute(unsigned i, Attribute::AttrKind Kind);
/// @brief removes the attributes from the list of attributes. /// @brief removes the attributes from the list of attributes.
void removeAttributes(unsigned i, AttributeSet attr); void removeAttributes(unsigned i, AttributeSet Attrs);
/// @brief check if an attributes is in the list of attributes. /// @brief check if an attributes is in the list of attributes.
bool hasAttribute(unsigned i, Attribute::AttrKind attr) const { bool hasAttribute(unsigned i, Attribute::AttrKind Kind) const {
return getAttributes().hasAttribute(i, attr); return getAttributes().hasAttribute(i, Kind);
} }
Attribute getAttribute(unsigned i, Attribute::AttrKind Kind) const { Attribute getAttribute(unsigned i, Attribute::AttrKind Kind) const {

View File

@ -1618,16 +1618,16 @@ public:
void setAttributes(const AttributeSet &Attrs) { AttributeList = Attrs; } void setAttributes(const AttributeSet &Attrs) { AttributeList = Attrs; }
/// addAttribute - adds the attribute to the list of attributes. /// addAttribute - adds the attribute to the list of attributes.
void addAttribute(unsigned i, Attribute::AttrKind attr); void addAttribute(unsigned i, Attribute::AttrKind Kind);
/// addAttribute - adds the attribute to the list of attributes. /// addAttribute - adds the attribute to the list of attributes.
void addAttribute(unsigned i, StringRef Kind, StringRef Value); void addAttribute(unsigned i, StringRef Kind, StringRef Value);
/// removeAttribute - removes the attribute from the list of attributes. /// removeAttribute - removes the attribute from the list of attributes.
void removeAttribute(unsigned i, Attribute::AttrKind attr); void removeAttribute(unsigned i, Attribute::AttrKind Kind);
/// removeAttribute - removes the attribute from the list of attributes. /// removeAttribute - removes the attribute from the list of attributes.
void removeAttribute(unsigned i, Attribute attr); void removeAttribute(unsigned i, Attribute Attr);
/// \brief adds the dereferenceable attribute to the list of attributes. /// \brief adds the dereferenceable attribute to the list of attributes.
void addDereferenceableAttr(unsigned i, uint64_t Bytes); void addDereferenceableAttr(unsigned i, uint64_t Bytes);
@ -1637,19 +1637,19 @@ public:
void addDereferenceableOrNullAttr(unsigned i, uint64_t Bytes); void addDereferenceableOrNullAttr(unsigned i, uint64_t Bytes);
/// \brief Determine whether this call has the given attribute. /// \brief Determine whether this call has the given attribute.
bool hasFnAttr(Attribute::AttrKind A) const { bool hasFnAttr(Attribute::AttrKind Kind) const {
assert(A != Attribute::NoBuiltin && assert(Kind != Attribute::NoBuiltin &&
"Use CallInst::isNoBuiltin() to check for Attribute::NoBuiltin"); "Use CallInst::isNoBuiltin() to check for Attribute::NoBuiltin");
return hasFnAttrImpl(A); return hasFnAttrImpl(Kind);
} }
/// \brief Determine whether this call has the given attribute. /// \brief Determine whether this call has the given attribute.
bool hasFnAttr(StringRef A) const { bool hasFnAttr(StringRef Kind) const {
return hasFnAttrImpl(A); return hasFnAttrImpl(Kind);
} }
/// \brief Determine whether the call or the callee has the given attributes. /// \brief Determine whether the call or the callee has the given attributes.
bool paramHasAttr(unsigned i, Attribute::AttrKind A) const; bool paramHasAttr(unsigned i, Attribute::AttrKind Kind) const;
/// \brief Return true if the data operand at index \p i has the attribute \p /// \brief Return true if the data operand at index \p i has the attribute \p
/// A. /// A.
@ -1664,7 +1664,7 @@ public:
/// \p i in [1, arg_size + 1) -> argument number (\p i - 1) /// \p i in [1, arg_size + 1) -> argument number (\p i - 1)
/// \p i in [arg_size + 1, data_operand_size + 1) -> bundle operand at index /// \p i in [arg_size + 1, data_operand_size + 1) -> bundle operand at index
/// (\p i - 1) in the operand list. /// (\p i - 1) in the operand list.
bool dataOperandHasImpliedAttr(unsigned i, Attribute::AttrKind A) const; bool dataOperandHasImpliedAttr(unsigned i, Attribute::AttrKind Kind) const;
/// \brief Extract the alignment for a call or parameter (0=unknown). /// \brief Extract the alignment for a call or parameter (0=unknown).
unsigned getParamAlignment(unsigned i) const { unsigned getParamAlignment(unsigned i) const {
@ -3562,13 +3562,13 @@ public:
void setAttributes(const AttributeSet &Attrs) { AttributeList = Attrs; } void setAttributes(const AttributeSet &Attrs) { AttributeList = Attrs; }
/// addAttribute - adds the attribute to the list of attributes. /// addAttribute - adds the attribute to the list of attributes.
void addAttribute(unsigned i, Attribute::AttrKind attr); void addAttribute(unsigned i, Attribute::AttrKind Kind);
/// removeAttribute - removes the attribute from the list of attributes. /// removeAttribute - removes the attribute from the list of attributes.
void removeAttribute(unsigned i, Attribute::AttrKind attr); void removeAttribute(unsigned i, Attribute::AttrKind Kind);
/// removeAttribute - removes the attribute from the list of attributes. /// removeAttribute - removes the attribute from the list of attributes.
void removeAttribute(unsigned i, Attribute attr); void removeAttribute(unsigned i, Attribute Attr);
/// \brief adds the dereferenceable attribute to the list of attributes. /// \brief adds the dereferenceable attribute to the list of attributes.
void addDereferenceableAttr(unsigned i, uint64_t Bytes); void addDereferenceableAttr(unsigned i, uint64_t Bytes);
@ -3578,19 +3578,19 @@ public:
void addDereferenceableOrNullAttr(unsigned i, uint64_t Bytes); void addDereferenceableOrNullAttr(unsigned i, uint64_t Bytes);
/// \brief Determine whether this call has the given attribute. /// \brief Determine whether this call has the given attribute.
bool hasFnAttr(Attribute::AttrKind A) const { bool hasFnAttr(Attribute::AttrKind Kind) const {
assert(A != Attribute::NoBuiltin && assert(Kind != Attribute::NoBuiltin &&
"Use CallInst::isNoBuiltin() to check for Attribute::NoBuiltin"); "Use CallInst::isNoBuiltin() to check for Attribute::NoBuiltin");
return hasFnAttrImpl(A); return hasFnAttrImpl(Kind);
} }
/// \brief Determine whether this call has the given attribute. /// \brief Determine whether this call has the given attribute.
bool hasFnAttr(StringRef A) const { bool hasFnAttr(StringRef Kind) const {
return hasFnAttrImpl(A); return hasFnAttrImpl(Kind);
} }
/// \brief Determine whether the call or the callee has the given attributes. /// \brief Determine whether the call or the callee has the given attributes.
bool paramHasAttr(unsigned i, Attribute::AttrKind A) const; bool paramHasAttr(unsigned i, Attribute::AttrKind Kind) const;
/// \brief Return true if the data operand at index \p i has the attribute \p /// \brief Return true if the data operand at index \p i has the attribute \p
/// A. /// A.
@ -3606,7 +3606,7 @@ public:
/// \p i in [1, arg_size + 1) -> argument number (\p i - 1) /// \p i in [1, arg_size + 1) -> argument number (\p i - 1)
/// \p i in [arg_size + 1, data_operand_size + 1) -> bundle operand at index /// \p i in [arg_size + 1, data_operand_size + 1) -> bundle operand at index
/// (\p i - 1) in the operand list. /// (\p i - 1) in the operand list.
bool dataOperandHasImpliedAttr(unsigned i, Attribute::AttrKind A) const; bool dataOperandHasImpliedAttr(unsigned i, Attribute::AttrKind Kind) const;
/// \brief Extract the alignment for a call or parameter (0=unknown). /// \brief Extract the alignment for a call or parameter (0=unknown).
unsigned getParamAlignment(unsigned i) const { unsigned getParamAlignment(unsigned i) const {

View File

@ -800,9 +800,9 @@ AttributeSet AttributeSet::get(LLVMContext &C, unsigned Index,
} }
AttributeSet AttributeSet::get(LLVMContext &C, unsigned Index, AttributeSet AttributeSet::get(LLVMContext &C, unsigned Index,
ArrayRef<Attribute::AttrKind> Kind) { ArrayRef<Attribute::AttrKind> Kinds) {
SmallVector<std::pair<unsigned, Attribute>, 8> Attrs; SmallVector<std::pair<unsigned, Attribute>, 8> Attrs;
for (Attribute::AttrKind K : Kind) for (Attribute::AttrKind K : Kinds)
Attrs.push_back(std::make_pair(Index, Attribute::get(C, K))); Attrs.push_back(std::make_pair(Index, Attribute::get(C, K)));
return get(C, Attrs); return get(C, Attrs);
} }
@ -838,16 +838,9 @@ AttributeSet AttributeSet::get(LLVMContext &C, ArrayRef<AttributeSet> Attrs) {
} }
AttributeSet AttributeSet::addAttribute(LLVMContext &C, unsigned Index, AttributeSet AttributeSet::addAttribute(LLVMContext &C, unsigned Index,
Attribute::AttrKind Attr) const { Attribute::AttrKind Kind) const {
if (hasAttribute(Index, Attr)) return *this; if (hasAttribute(Index, Kind)) return *this;
return addAttributes(C, Index, AttributeSet::get(C, Index, Attr)); return addAttributes(C, Index, AttributeSet::get(C, Index, Kind));
}
AttributeSet AttributeSet::addAttribute(LLVMContext &C, unsigned Index,
StringRef Kind) const {
llvm::AttrBuilder B;
B.addAttribute(Kind);
return addAttributes(C, Index, AttributeSet::get(C, Index, B));
} }
AttributeSet AttributeSet::addAttribute(LLVMContext &C, unsigned Index, AttributeSet AttributeSet::addAttribute(LLVMContext &C, unsigned Index,
@ -937,9 +930,9 @@ AttributeSet AttributeSet::addAttributes(LLVMContext &C, unsigned Index,
} }
AttributeSet AttributeSet::removeAttribute(LLVMContext &C, unsigned Index, AttributeSet AttributeSet::removeAttribute(LLVMContext &C, unsigned Index,
Attribute::AttrKind Attr) const { Attribute::AttrKind Kind) const {
if (!hasAttribute(Index, Attr)) return *this; if (!hasAttribute(Index, Kind)) return *this;
return removeAttributes(C, Index, AttributeSet::get(C, Index, Attr)); return removeAttributes(C, Index, AttributeSet::get(C, Index, Kind));
} }
AttributeSet AttributeSet::removeAttributes(LLVMContext &C, unsigned Index, AttributeSet AttributeSet::removeAttributes(LLVMContext &C, unsigned Index,

View File

@ -366,9 +366,9 @@ void Function::dropAllReferences() {
clearMetadata(); clearMetadata();
} }
void Function::addAttribute(unsigned i, Attribute::AttrKind attr) { void Function::addAttribute(unsigned i, Attribute::AttrKind Kind) {
AttributeSet PAL = getAttributes(); AttributeSet PAL = getAttributes();
PAL = PAL.addAttribute(getContext(), i, attr); PAL = PAL.addAttribute(getContext(), i, Kind);
setAttributes(PAL); setAttributes(PAL);
} }
@ -378,21 +378,21 @@ void Function::addAttribute(unsigned i, Attribute Attr) {
setAttributes(PAL); setAttributes(PAL);
} }
void Function::addAttributes(unsigned i, AttributeSet attrs) { void Function::addAttributes(unsigned i, AttributeSet Attrs) {
AttributeSet PAL = getAttributes(); AttributeSet PAL = getAttributes();
PAL = PAL.addAttributes(getContext(), i, attrs); PAL = PAL.addAttributes(getContext(), i, Attrs);
setAttributes(PAL); setAttributes(PAL);
} }
void Function::removeAttribute(unsigned i, Attribute::AttrKind attr) { void Function::removeAttribute(unsigned i, Attribute::AttrKind Kind) {
AttributeSet PAL = getAttributes(); AttributeSet PAL = getAttributes();
PAL = PAL.removeAttribute(getContext(), i, attr); PAL = PAL.removeAttribute(getContext(), i, Kind);
setAttributes(PAL); setAttributes(PAL);
} }
void Function::removeAttributes(unsigned i, AttributeSet attrs) { void Function::removeAttributes(unsigned i, AttributeSet Attrs) {
AttributeSet PAL = getAttributes(); AttributeSet PAL = getAttributes();
PAL = PAL.removeAttributes(getContext(), i, attrs); PAL = PAL.removeAttributes(getContext(), i, Attrs);
setAttributes(PAL); setAttributes(PAL);
} }

View File

@ -331,9 +331,9 @@ CallInst *CallInst::Create(CallInst *CI, ArrayRef<OperandBundleDef> OpB,
return NewCI; return NewCI;
} }
void CallInst::addAttribute(unsigned i, Attribute::AttrKind attr) { void CallInst::addAttribute(unsigned i, Attribute::AttrKind Kind) {
AttributeSet PAL = getAttributes(); AttributeSet PAL = getAttributes();
PAL = PAL.addAttribute(getContext(), i, attr); PAL = PAL.addAttribute(getContext(), i, Kind);
setAttributes(PAL); setAttributes(PAL);
} }
@ -343,15 +343,15 @@ void CallInst::addAttribute(unsigned i, StringRef Kind, StringRef Value) {
setAttributes(PAL); setAttributes(PAL);
} }
void CallInst::removeAttribute(unsigned i, Attribute::AttrKind attr) { void CallInst::removeAttribute(unsigned i, Attribute::AttrKind Kind) {
AttributeSet PAL = getAttributes(); AttributeSet PAL = getAttributes();
PAL = PAL.removeAttribute(getContext(), i, attr); PAL = PAL.removeAttribute(getContext(), i, Kind);
setAttributes(PAL); setAttributes(PAL);
} }
void CallInst::removeAttribute(unsigned i, Attribute attr) { void CallInst::removeAttribute(unsigned i, Attribute Attr) {
AttributeSet PAL = getAttributes(); AttributeSet PAL = getAttributes();
AttrBuilder B(attr); AttrBuilder B(Attr);
LLVMContext &Context = getContext(); LLVMContext &Context = getContext();
PAL = PAL.removeAttributes(Context, i, PAL = PAL.removeAttributes(Context, i,
AttributeSet::get(Context, i, B)); AttributeSet::get(Context, i, B));
@ -370,19 +370,18 @@ void CallInst::addDereferenceableOrNullAttr(unsigned i, uint64_t Bytes) {
setAttributes(PAL); setAttributes(PAL);
} }
bool CallInst::paramHasAttr(unsigned i, Attribute::AttrKind A) const { bool CallInst::paramHasAttr(unsigned i, Attribute::AttrKind Kind) const {
assert(i < (getNumArgOperands() + 1) && "Param index out of bounds!"); assert(i < (getNumArgOperands() + 1) && "Param index out of bounds!");
if (AttributeList.hasAttribute(i, A)) if (AttributeList.hasAttribute(i, Kind))
return true; return true;
if (const Function *F = getCalledFunction()) if (const Function *F = getCalledFunction())
return F->getAttributes().hasAttribute(i, A); return F->getAttributes().hasAttribute(i, Kind);
return false; return false;
} }
bool CallInst::dataOperandHasImpliedAttr(unsigned i, bool CallInst::dataOperandHasImpliedAttr(unsigned i,
Attribute::AttrKind A) const { Attribute::AttrKind Kind) const {
// There are getNumOperands() - 1 data operands. The last operand is the // There are getNumOperands() - 1 data operands. The last operand is the
// callee. // callee.
assert(i < getNumOperands() && "Data operand index out of bounds!"); assert(i < getNumOperands() && "Data operand index out of bounds!");
@ -392,11 +391,11 @@ bool CallInst::dataOperandHasImpliedAttr(unsigned i,
// containing operand bundle, if the operand is a bundle operand. // containing operand bundle, if the operand is a bundle operand.
if (i < (getNumArgOperands() + 1)) if (i < (getNumArgOperands() + 1))
return paramHasAttr(i, A); return paramHasAttr(i, Kind);
assert(hasOperandBundles() && i >= (getBundleOperandsStartIndex() + 1) && assert(hasOperandBundles() && i >= (getBundleOperandsStartIndex() + 1) &&
"Must be either a call argument or an operand bundle!"); "Must be either a call argument or an operand bundle!");
return bundleOperandHasAttr(i - 1, A); return bundleOperandHasAttr(i - 1, Kind);
} }
/// IsConstantOne - Return true only if val is constant int 1 /// IsConstantOne - Return true only if val is constant int 1
@ -669,18 +668,18 @@ void InvokeInst::setSuccessorV(unsigned idx, BasicBlock *B) {
return setSuccessor(idx, B); return setSuccessor(idx, B);
} }
bool InvokeInst::paramHasAttr(unsigned i, Attribute::AttrKind A) const { bool InvokeInst::paramHasAttr(unsigned i, Attribute::AttrKind Kind) const {
assert(i < (getNumArgOperands() + 1) && "Param index out of bounds!"); assert(i < (getNumArgOperands() + 1) && "Param index out of bounds!");
if (AttributeList.hasAttribute(i, A)) if (AttributeList.hasAttribute(i, Kind))
return true; return true;
if (const Function *F = getCalledFunction()) if (const Function *F = getCalledFunction())
return F->getAttributes().hasAttribute(i, A); return F->getAttributes().hasAttribute(i, Kind);
return false; return false;
} }
bool InvokeInst::dataOperandHasImpliedAttr(unsigned i, bool InvokeInst::dataOperandHasImpliedAttr(unsigned i,
Attribute::AttrKind A) const { Attribute::AttrKind Kind) const {
// There are getNumOperands() - 3 data operands. The last three operands are // There are getNumOperands() - 3 data operands. The last three operands are
// the callee and the two successor basic blocks. // the callee and the two successor basic blocks.
assert(i < (getNumOperands() - 2) && "Data operand index out of bounds!"); assert(i < (getNumOperands() - 2) && "Data operand index out of bounds!");
@ -690,28 +689,28 @@ bool InvokeInst::dataOperandHasImpliedAttr(unsigned i,
// containing operand bundle, if the operand is a bundle operand. // containing operand bundle, if the operand is a bundle operand.
if (i < (getNumArgOperands() + 1)) if (i < (getNumArgOperands() + 1))
return paramHasAttr(i, A); return paramHasAttr(i, Kind);
assert(hasOperandBundles() && i >= (getBundleOperandsStartIndex() + 1) && assert(hasOperandBundles() && i >= (getBundleOperandsStartIndex() + 1) &&
"Must be either an invoke argument or an operand bundle!"); "Must be either an invoke argument or an operand bundle!");
return bundleOperandHasAttr(i - 1, A); return bundleOperandHasAttr(i - 1, Kind);
} }
void InvokeInst::addAttribute(unsigned i, Attribute::AttrKind attr) { void InvokeInst::addAttribute(unsigned i, Attribute::AttrKind Kind) {
AttributeSet PAL = getAttributes(); AttributeSet PAL = getAttributes();
PAL = PAL.addAttribute(getContext(), i, attr); PAL = PAL.addAttribute(getContext(), i, Kind);
setAttributes(PAL); setAttributes(PAL);
} }
void InvokeInst::removeAttribute(unsigned i, Attribute::AttrKind attr) { void InvokeInst::removeAttribute(unsigned i, Attribute::AttrKind Kind) {
AttributeSet PAL = getAttributes(); AttributeSet PAL = getAttributes();
PAL = PAL.removeAttribute(getContext(), i, attr); PAL = PAL.removeAttribute(getContext(), i, Kind);
setAttributes(PAL); setAttributes(PAL);
} }
void InvokeInst::removeAttribute(unsigned i, Attribute attr) { void InvokeInst::removeAttribute(unsigned i, Attribute Attr) {
AttributeSet PAL = getAttributes(); AttributeSet PAL = getAttributes();
AttrBuilder B(attr); AttrBuilder B(Attr);
PAL = PAL.removeAttributes(getContext(), i, PAL = PAL.removeAttributes(getContext(), i,
AttributeSet::get(getContext(), i, B)); AttributeSet::get(getContext(), i, B));
setAttributes(PAL); setAttributes(PAL);