Two ParamAttrsVectors which differ by a permutation
authorDuncan Sands <baldrick@free.fr>
Tue, 11 Sep 2007 14:40:04 +0000 (14:40 +0000)
committerDuncan Sands <baldrick@free.fr>
Tue, 11 Sep 2007 14:40:04 +0000 (14:40 +0000)
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

lib/VMCore/Function.cpp

index a4bc69b4721d513648aeadf895ffee1cbee6b1b6..3582b321504f1e19ef94639817116d3195d6c5b7 100644 (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);