[llvm] r174120 - Add iterators to the AttributeSet class so that we can access the Attributes in a nice way.
Bill Wendling
isanbard at gmail.com
Thu Jan 31 15:53:05 PST 2013
Author: void
Date: Thu Jan 31 17:53:05 2013
New Revision: 174120
URL: http://llvm.org/viewvc/llvm-project?rev=174120&view=rev
Log:
Add iterators to the AttributeSet class so that we can access the Attributes in a nice way.
Modified:
llvm/trunk/include/llvm/IR/Attributes.h
llvm/trunk/lib/IR/Attributes.cpp
Modified: llvm/trunk/include/llvm/IR/Attributes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Attributes.h?rev=174120&r1=174119&r2=174120&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/Attributes.h (original)
+++ llvm/trunk/include/llvm/IR/Attributes.h Thu Jan 31 17:53:05 2013
@@ -270,6 +270,11 @@ public:
/// \brief Return the attributes at the index as a string.
std::string getAsString(unsigned Index) const;
+ typedef ArrayRef<Attribute>::iterator iterator;
+
+ iterator begin(unsigned Idx);
+ iterator end(unsigned Idx);
+
/// operator==/!= - Provide equality predicates.
bool operator==(const AttributeSet &RHS) const {
return pImpl == RHS.pImpl;
Modified: llvm/trunk/lib/IR/Attributes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Attributes.cpp?rev=174120&r1=174119&r2=174120&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Attributes.cpp (original)
+++ llvm/trunk/lib/IR/Attributes.cpp Thu Jan 31 17:53:05 2013
@@ -740,6 +740,18 @@ AttributeSetNode *AttributeSet::getAttri
return 0;
}
+AttributeSet::iterator AttributeSet::begin(unsigned Idx) {
+ if (!pImpl)
+ return ArrayRef<Attribute>().begin();
+ return pImpl->begin(Idx);
+}
+
+AttributeSet::iterator AttributeSet::end(unsigned Idx) {
+ if (!pImpl)
+ return ArrayRef<Attribute>().end();
+ return pImpl->begin(Idx);
+}
+
//===----------------------------------------------------------------------===//
// AttributeSet Introspection Methods
//===----------------------------------------------------------------------===//
More information about the llvm-commits
mailing list