if (D)
SetFunctionAttributes(GD, F, IsIncompleteFunction, IsThunk);
if (ExtraAttrs.hasFnAttrs()) {
- llvm::AttrBuilder B(F->getContext(), ExtraAttrs, llvm::AttributeList::FunctionIndex);
+ llvm::AttrBuilder B(F->getContext(), ExtraAttrs.getFnAttrs());
F->addFnAttrs(B);
}
addAttribute(A);
}
- AttrBuilder(LLVMContext &Ctx, AttributeList AS, unsigned Idx);
AttrBuilder(LLVMContext &Ctx, AttributeSet AS);
void clear();
bool &ADS = AllowDifferingSizes ? *AllowDifferingSizes : DummyADS;
ADS = true;
- AttrBuilder CallerAttrs(F->getContext(), F->getAttributes(), AttributeList::ReturnIndex);
- AttrBuilder CalleeAttrs(F->getContext(), cast<CallInst>(I)->getAttributes(),
- AttributeList::ReturnIndex);
+ AttrBuilder CallerAttrs(F->getContext(), F->getAttributes().getRetAttrs());
+ AttrBuilder CalleeAttrs(F->getContext(),
+ cast<CallInst>(I)->getAttributes().getRetAttrs());
// Following attributes are completely benign as far as calling convention
// goes, they shouldn't affect whether the call is a tail call.
// the return. Ignore NoAlias and NonNull because they don't affect the
// call sequence.
AttributeList CallerAttrs = F.getAttributes();
- if (AttrBuilder(F.getContext(), CallerAttrs, AttributeList::ReturnIndex)
+ if (AttrBuilder(F.getContext(), CallerAttrs.getRetAttrs())
.removeAttribute(Attribute::NoAlias)
.removeAttribute(Attribute::NonNull)
.hasAttributes())
// Conservatively require the attributes of the call to match those of
// the return. Ignore following attributes because they don't affect the
// call sequence.
- AttrBuilder CallerAttrs(F.getContext(), F.getAttributes(), AttributeList::ReturnIndex);
+ AttrBuilder CallerAttrs(F.getContext(), F.getAttributes().getRetAttrs());
for (const auto &Attr : {Attribute::Alignment, Attribute::Dereferenceable,
Attribute::DereferenceableOrNull, Attribute::NoAlias,
Attribute::NonNull})
// AttrBuilder Method Implementations
//===----------------------------------------------------------------------===//
-// FIXME: Remove this ctor, use AttributeSet.
-AttrBuilder::AttrBuilder(LLVMContext &Ctx, AttributeList AL, unsigned Index)
- : Ctx(Ctx) {
- AttributeSet AS = AL.getAttributes(Index);
- for (const auto &A : AS)
- addAttribute(A);
-}
-
AttrBuilder::AttrBuilder(LLVMContext &Ctx, AttributeSet AS) : Ctx(Ctx) {
for (const auto &A : AS)
addAttribute(A);
}
if (!CallerPAL.isEmpty() && !Caller->use_empty()) {
- AttrBuilder RAttrs(FT->getContext(), CallerPAL, AttributeList::ReturnIndex);
+ AttrBuilder RAttrs(FT->getContext(), CallerPAL.getRetAttrs());
if (RAttrs.overlaps(AttributeFuncs::typeIncompatible(NewRetTy)))
return false; // Attribute not compatible with transformed value.
}
ArgAttrs.reserve(NumActualArgs);
// Get any return attributes.
- AttrBuilder RAttrs(FT->getContext(), CallerPAL, AttributeList::ReturnIndex);
+ AttrBuilder RAttrs(FT->getContext(), CallerPAL.getRetAttrs());
// If the return value is not being used, the type may not be compatible
// with the existing attributes. Wipe out any problematic attributes.
// If the return type of the call site doesn't match that of the callee, cast
// the returned value to the appropriate type.
// Remove any incompatible return value attribute.
- AttrBuilder RAttrs(Ctx, CallerPAL, AttributeList::ReturnIndex);
+ AttrBuilder RAttrs(Ctx, CallerPAL.getRetAttrs());
if (!CallSiteRetTy->isVoidTy() && CallSiteRetTy != CalleeRetTy) {
createRetBitCast(CB, CallSiteRetTy, RetBitCast);
RAttrs.remove(AttributeFuncs::typeIncompatible(CalleeRetTy));
static AttrBuilder IdentifyValidAttributes(CallBase &CB) {
- AttrBuilder AB(CB.getContext(), CB.getAttributes(), AttributeList::ReturnIndex);
+ AttrBuilder AB(CB.getContext(), CB.getAttributes().getRetAttrs());
if (!AB.hasAttributes())
return AB;
AttrBuilder Valid(CB.getContext());