aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2007-11-20 14:09:29 +0000
committerDuncan Sands <baldrick@free.fr>2007-11-20 14:09:29 +0000
commite2898f0a1e04b1873482e16d9fdc3d719153b481 (patch)
treeb185f354f83376786eef43ac3ae56f38be5f95e5 /lib/VMCore
parent3a8a41f265f7e31d340a71e1ab35e30e534cc1cf (diff)
downloadexternal_llvm-e2898f0a1e04b1873482e16d9fdc3d719153b481.zip
external_llvm-e2898f0a1e04b1873482e16d9fdc3d719153b481.tar.gz
external_llvm-e2898f0a1e04b1873482e16d9fdc3d719153b481.tar.bz2
In order for parameter attribute uniquing to make
any sense it is important that ParamAttr::None gets treated the same as not supplying an attribute at all. Rather than stripping ParamAttr::None out of the list of attributes, assert if ParamAttr::None is seen. Fix up the bitcode reader which liked to insert ParamAttr::None all over the place. Patch based on one by Török Edwin. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44250 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/Function.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp
index 3256d5b..a011aae 100644
--- a/lib/VMCore/Function.cpp
+++ b/lib/VMCore/Function.cpp
@@ -129,8 +129,12 @@ 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!");
+ for (unsigned i = 0, e = attrVec.size(); i < e; ++i) {
+ assert(attrVec[i].attrs != ParamAttr::None
+ && "Pointless parameter attribute!");
+ assert((!i || attrVec[i-1].index < attrVec[i].index)
+ && "Misordered ParamAttrsList!");
+ }
#endif
ParamAttrsList key(attrVec);
FoldingSetNodeID ID;