diff options
author | Amaury Sechet <deadalnix@gmail.com> | 2016-09-09 04:50:38 +0000 |
---|---|---|
committer | Amaury Sechet <deadalnix@gmail.com> | 2016-09-09 04:50:38 +0000 |
commit | 5f04d819a55a6a9f37216cf13bf5b939d5a48086 (patch) | |
tree | 8f17bf18bff6b8d4fd7f58cc304c7d7973cd816e /llvm/lib/IR/Instructions.cpp | |
parent | 21f51b3a32fd47c5d1e4de1fff04367fb28dffee (diff) | |
download | bcm5719-llvm-5f04d819a55a6a9f37216cf13bf5b939d5a48086.tar.gz bcm5719-llvm-5f04d819a55a6a9f37216cf13bf5b939d5a48086.zip |
Rationalise the attribute getter/setter methods on Function and CallSite.
Summary:
While woring on mapping attributes in the C API, it clearly appeared that the recent changes in the API on the C++ side left Function and Call/Invoke with an attribute API that grew in an ad hoc manner. This makes it difficult to work with it, because one doesn't know which overloads exists and which do not.
Make sure that getter/setter function exists for both enum and string version. Remove inconsistent getter/setter, unless they have many callsites.
This should make it easier to work with attributes in the future.
This doesn't change how attribute works.
Reviewers: bkramer, whitequark, mehdi_amini, void
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D21514
llvm-svn: 281019
Diffstat (limited to 'llvm/lib/IR/Instructions.cpp')
-rw-r--r-- | llvm/lib/IR/Instructions.cpp | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp index 89c2caf0dbb..e29f8250f12 100644 --- a/llvm/lib/IR/Instructions.cpp +++ b/llvm/lib/IR/Instructions.cpp @@ -350,12 +350,6 @@ void CallInst::addAttribute(unsigned i, Attribute::AttrKind Kind) { setAttributes(PAL); } -void CallInst::addAttribute(unsigned i, StringRef Kind, StringRef Value) { - AttributeSet PAL = getAttributes(); - PAL = PAL.addAttribute(getContext(), i, Kind, Value); - setAttributes(PAL); -} - void CallInst::addAttribute(unsigned i, Attribute Attr) { AttributeSet PAL = getAttributes(); PAL = PAL.addAttribute(getContext(), i, Attr); @@ -374,15 +368,6 @@ void CallInst::removeAttribute(unsigned i, StringRef Kind) { setAttributes(PAL); } -void CallInst::removeAttribute(unsigned i, Attribute Attr) { - AttributeSet PAL = getAttributes(); - AttrBuilder B(Attr); - LLVMContext &Context = getContext(); - PAL = PAL.removeAttributes(Context, i, - AttributeSet::get(Context, i, B)); - setAttributes(PAL); -} - void CallInst::addDereferenceableAttr(unsigned i, uint64_t Bytes) { AttributeSet PAL = getAttributes(); PAL = PAL.addDereferenceableAttr(getContext(), i, Bytes); @@ -405,14 +390,6 @@ bool CallInst::paramHasAttr(unsigned i, Attribute::AttrKind Kind) const { return false; } -Attribute CallInst::getAttribute(unsigned i, Attribute::AttrKind Kind) const { - return getAttributes().getAttribute(i, Kind); -} - -Attribute CallInst::getAttribute(unsigned i, StringRef Kind) const { - return getAttributes().getAttribute(i, Kind); -} - bool CallInst::dataOperandHasImpliedAttr(unsigned i, Attribute::AttrKind Kind) const { // There are getNumOperands() - 1 data operands. The last operand is the @@ -766,23 +743,6 @@ void InvokeInst::removeAttribute(unsigned i, StringRef Kind) { setAttributes(PAL); } -void InvokeInst::removeAttribute(unsigned i, Attribute Attr) { - AttributeSet PAL = getAttributes(); - AttrBuilder B(Attr); - PAL = PAL.removeAttributes(getContext(), i, - AttributeSet::get(getContext(), i, B)); - setAttributes(PAL); -} - -Attribute InvokeInst::getAttribute(unsigned i, - Attribute::AttrKind Kind) const { - return getAttributes().getAttribute(i, Kind); -} - -Attribute InvokeInst::getAttribute(unsigned i, StringRef Kind) const { - return getAttributes().getAttribute(i, Kind); -} - void InvokeInst::addDereferenceableAttr(unsigned i, uint64_t Bytes) { AttributeSet PAL = getAttributes(); PAL = PAL.addDereferenceableAttr(getContext(), i, Bytes); |