mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-23 14:25:07 +00:00
IR: Cleanup AttributeSet::get for AttrBuilder
We don't modify the AttrBuilder in AttributeSet::get, make the reference argument const. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207924 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -242,7 +242,7 @@ public:
|
|||||||
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> Kind);
|
||||||
static AttributeSet get(LLVMContext &C, unsigned Index, AttrBuilder &B);
|
static AttributeSet get(LLVMContext &C, unsigned Index, const AttrBuilder &B);
|
||||||
|
|
||||||
/// \brief Add an attribute to the attribute set at the given index. Since
|
/// \brief Add an attribute to the attribute set at the given index. Since
|
||||||
/// attribute sets are immutable, this returns a new set.
|
/// attribute sets are immutable, this returns a new set.
|
||||||
@@ -469,6 +469,8 @@ public:
|
|||||||
typedef std::pair<std::string, std::string> td_type;
|
typedef std::pair<std::string, std::string> td_type;
|
||||||
typedef std::map<std::string, std::string>::iterator td_iterator;
|
typedef std::map<std::string, std::string>::iterator td_iterator;
|
||||||
typedef std::map<std::string, std::string>::const_iterator td_const_iterator;
|
typedef std::map<std::string, std::string>::const_iterator td_const_iterator;
|
||||||
|
typedef llvm::iterator_range<td_iterator> td_range;
|
||||||
|
typedef llvm::iterator_range<td_const_iterator> td_const_range;
|
||||||
|
|
||||||
td_iterator td_begin() { return TargetDepAttrs.begin(); }
|
td_iterator td_begin() { return TargetDepAttrs.begin(); }
|
||||||
td_iterator td_end() { return TargetDepAttrs.end(); }
|
td_iterator td_end() { return TargetDepAttrs.end(); }
|
||||||
@@ -476,6 +478,11 @@ public:
|
|||||||
td_const_iterator td_begin() const { return TargetDepAttrs.begin(); }
|
td_const_iterator td_begin() const { return TargetDepAttrs.begin(); }
|
||||||
td_const_iterator td_end() const { return TargetDepAttrs.end(); }
|
td_const_iterator td_end() const { return TargetDepAttrs.end(); }
|
||||||
|
|
||||||
|
td_range td_attrs() { return td_range(td_begin(), td_end()); }
|
||||||
|
td_const_range td_attrs() const {
|
||||||
|
return td_const_range(td_begin(), td_end());
|
||||||
|
}
|
||||||
|
|
||||||
bool td_empty() const { return TargetDepAttrs.empty(); }
|
bool td_empty() const { return TargetDepAttrs.empty(); }
|
||||||
|
|
||||||
bool operator==(const AttrBuilder &B);
|
bool operator==(const AttrBuilder &B);
|
||||||
|
@@ -596,7 +596,8 @@ AttributeSet AttributeSet::get(LLVMContext &C,
|
|||||||
return getImpl(C, Attrs);
|
return getImpl(C, Attrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
AttributeSet AttributeSet::get(LLVMContext &C, unsigned Index, AttrBuilder &B) {
|
AttributeSet AttributeSet::get(LLVMContext &C, unsigned Index,
|
||||||
|
const AttrBuilder &B) {
|
||||||
if (!B.hasAttributes())
|
if (!B.hasAttributes())
|
||||||
return AttributeSet();
|
return AttributeSet();
|
||||||
|
|
||||||
@@ -618,9 +619,9 @@ AttributeSet AttributeSet::get(LLVMContext &C, unsigned Index, AttrBuilder &B) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add target-dependent (string) attributes.
|
// Add target-dependent (string) attributes.
|
||||||
for (AttrBuilder::td_iterator I = B.td_begin(), E = B.td_end();
|
for (const AttrBuilder::td_type &TDA : B.td_attrs())
|
||||||
I != E; ++I)
|
Attrs.push_back(
|
||||||
Attrs.push_back(std::make_pair(Index, Attribute::get(C, I->first,I->second)));
|
std::make_pair(Index, Attribute::get(C, TDA.first, TDA.second)));
|
||||||
|
|
||||||
return get(C, Attrs);
|
return get(C, Attrs);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user