diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2013-08-02 22:29:40 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2013-08-02 22:29:40 +0000 |
commit | 7bba9c5c0a5235f585ee4bd3efec29e0982de3f8 (patch) | |
tree | a71aaf7262c355f807479751ebe690794b2ce8d6 /lib/IR/AttributeImpl.h | |
parent | 6bf104b165cec9c14dacf10bf3380eeb32c278d7 (diff) | |
download | llvm-7bba9c5c0a5235f585ee4bd3efec29e0982de3f8.tar.gz llvm-7bba9c5c0a5235f585ee4bd3efec29e0982de3f8.tar.bz2 llvm-7bba9c5c0a5235f585ee4bd3efec29e0982de3f8.tar.xz |
Make one of the AttributeSet ctors maintain the invariant that the
attribute list is ordered by index.
Differential Revision: http://llvm-reviews.chandlerc.com/D1265
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187682 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/IR/AttributeImpl.h')
-rw-r--r-- | lib/IR/AttributeImpl.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/IR/AttributeImpl.h b/lib/IR/AttributeImpl.h index 5a72c37505..7bf9e8ab6b 100644 --- a/lib/IR/AttributeImpl.h +++ b/lib/IR/AttributeImpl.h @@ -200,6 +200,15 @@ public: AttributeSetImpl(LLVMContext &C, ArrayRef<std::pair<unsigned, AttributeSetNode *> > Attrs) : Context(C), NumAttrs(Attrs.size()) { +#ifndef NDEBUG + if (Attrs.size() >= 2) { + for (const std::pair<unsigned, AttributeSetNode *> *i = Attrs.begin() + 1, + *e = Attrs.end(); + i != e; ++i) { + assert((i-1)->first <= i->first && "Attribute set not ordered!"); + } + } +#endif // There's memory after the node where we can store the entries in. std::copy(Attrs.begin(), Attrs.end(), reinterpret_cast<IndexAttrPair *>(this + 1)); |