Two ParamAttrsVectors which differ by a permutation

of their elements do not yield the same ParamAttrsList,
though they should.  On the other hand, everyone seems
to pass such vectors with elements ordered by increasing
index, so rather than sorting the elements simply assert
that the elements are ordered in this way.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41845 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan Sands 2007-09-11 14:40:04 +00:00
parent b84abcd77d
commit d50dc73b89

View File

@ -124,6 +124,10 @@ static ManagedStatic<FoldingSet<ParamAttrsList> > ParamAttrsLists;
ParamAttrsList *
ParamAttrsList::get(const ParamAttrsVector &attrVec) {
assert(!attrVec.empty() && "Illegal to create empty ParamAttrsList");
#ifndef NDEBUG
for (unsigned i = 1, e = attrVec.size(); i < e; ++i)
assert(attrVec[i-1].index < attrVec[i].index && "Misordered ParamAttrsList!");
#endif
ParamAttrsList key(attrVec);
FoldingSetNodeID ID;
key.Profile(ID);