diff options
Diffstat (limited to 'llvm/lib/IR')
-rw-r--r-- | llvm/lib/IR/AttributeImpl.h | 2 | ||||
-rw-r--r-- | llvm/lib/IR/Attributes.cpp | 20 |
2 files changed, 22 insertions, 0 deletions
diff --git a/llvm/lib/IR/AttributeImpl.h b/llvm/lib/IR/AttributeImpl.h index 10f30e740c7..b5d292ee275 100644 --- a/llvm/lib/IR/AttributeImpl.h +++ b/llvm/lib/IR/AttributeImpl.h @@ -39,6 +39,8 @@ public: ArrayRef<Constant*> values); AttributeImpl(LLVMContext &C, StringRef data); + LLVMContext &getContext() { return Context; } + ArrayRef<Constant*> getValues() const { return Vals; } bool hasAttribute(Attribute::AttrKind A) const; diff --git a/llvm/lib/IR/Attributes.cpp b/llvm/lib/IR/Attributes.cpp index 5de18272ffb..d3f284a41d8 100644 --- a/llvm/lib/IR/Attributes.cpp +++ b/llvm/lib/IR/Attributes.cpp @@ -530,9 +530,29 @@ void AttributeImpl::Profile(FoldingSetNodeID &ID, Constant *Data, } //===----------------------------------------------------------------------===// +// AttributeWithIndex Definition +//===----------------------------------------------------------------------===// + +AttributeWithIndex AttributeWithIndex::get(LLVMContext &C, unsigned Idx, + AttributeSet AS) { + // FIXME: This is temporary, but necessary for the conversion. + AttrBuilder B(AS, Idx); + return get(Idx, Attribute::get(C, B)); +} + +//===----------------------------------------------------------------------===// // AttributeSetImpl Definition //===----------------------------------------------------------------------===// +AttributeSet AttributeSet::getFnAttributes() const { + // FIXME: Remove. + return AttrList ? + AttributeSet::get(AttrList->getContext(), + AttributeWithIndex::get(FunctionIndex, + getAttributes(FunctionIndex))) : + AttributeSet(); +} + AttributeSet AttributeSet::get(LLVMContext &C, ArrayRef<AttributeWithIndex> Attrs) { // If there are no attributes then return a null AttributesList pointer. |