[llvm-commits] [llvm] r41845 - /llvm/trunk/lib/VMCore/Function.cpp

Duncan Sands baldrick at free.fr
Tue Sep 11 07:40:05 PDT 2007


Author: baldrick
Date: Tue Sep 11 09:40:04 2007
New Revision: 41845

URL: http://llvm.org/viewvc/llvm-project?rev=41845&view=rev
Log:
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.

Modified:
    llvm/trunk/lib/VMCore/Function.cpp

Modified: llvm/trunk/lib/VMCore/Function.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Function.cpp?rev=41845&r1=41844&r2=41845&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/Function.cpp (original)
+++ llvm/trunk/lib/VMCore/Function.cpp Tue Sep 11 09:40:04 2007
@@ -124,6 +124,10 @@
 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);





More information about the llvm-commits mailing list