summaryrefslogtreecommitdiffstats
path: root/lib/Bitcode
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
commit5e41f6569918a6e001cadf8dea96819686cf301c (patch)
treeb185f354f83376786eef43ac3ae56f38be5f95e5 /lib/Bitcode
parent6e801dc6c0a7b04e154f5fbb3a2b04cc355d194d (diff)
downloadexternal_llvm-5e41f6569918a6e001cadf8dea96819686cf301c.zip
external_llvm-5e41f6569918a6e001cadf8dea96819686cf301c.tar.gz
external_llvm-5e41f6569918a6e001cadf8dea96819686cf301c.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/Bitcode')
-rw-r--r--lib/Bitcode/Reader/BitcodeReader.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp
index aa78e7c..119a583 100644
--- a/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -232,17 +232,15 @@ bool BitcodeReader::ParseParamAttrBlock() {
if (Record.size() & 1)
return Error("Invalid ENTRY record");
- ParamAttrsWithIndex PAWI;
for (unsigned i = 0, e = Record.size(); i != e; i += 2) {
- PAWI.index = Record[i];
- PAWI.attrs = Record[i+1];
- Attrs.push_back(PAWI);
+ if (Record[i+1] != ParamAttr::None)
+ Attrs.push_back(ParamAttrsWithIndex::get(Record[i], Record[i+1]));
}
- ParamAttrs.push_back(ParamAttrsList::get(Attrs));
+ ParamAttrs.push_back(Attrs.empty() ? NULL : ParamAttrsList::get(Attrs));
Attrs.clear();
break;
}
- }
+ }
}
}