aboutsummaryrefslogtreecommitdiff
path: root/lib/VMCore/Function.cpp
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2007-09-11 14:40:04 +0000
committerDuncan Sands <baldrick@free.fr>2007-09-11 14:40:04 +0000
commitd50dc73b8934e751dfe21412c020c4e687e9ae17 (patch)
treed5ca2c0d5f0f4d8abea82103da0b5a85d8ca285b /lib/VMCore/Function.cpp
parentb84abcd77ddacc15a66f5261bd9561fc04dec63e (diff)
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
Diffstat (limited to 'lib/VMCore/Function.cpp')
-rw-r--r--lib/VMCore/Function.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp
index a4bc69b472..3582b32150 100644
--- a/lib/VMCore/Function.cpp
+++ b/lib/VMCore/Function.cpp
@@ -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);