[llvm-commits] [llvm] r48276 - /llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
Chris Lattner
sabre at nondot.org
Tue Mar 11 19:25:52 PDT 2008
Author: lattner
Date: Tue Mar 11 21:25:52 2008
New Revision: 48276
URL: http://llvm.org/viewvc/llvm-project?rev=48276&view=rev
Log:
when the bitcode reader is referencing a paramattr, make sure to bump its refcount.
Modified:
llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=48276&r1=48275&r2=48276&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Tue Mar 11 21:25:52 2008
@@ -31,6 +31,11 @@
Buffer = 0;
std::vector<PATypeHolder>().swap(TypeList);
ValueList.clear();
+
+ // Drop references to ParamAttrs.
+ for (unsigned i = 0, e = ParamAttrs.size(); i != e; ++i)
+ ParamAttrs[i]->dropRef();
+
std::vector<const ParamAttrsList*>().swap(ParamAttrs);
std::vector<BasicBlock*>().swap(FunctionBBs);
std::vector<Function*>().swap(FunctionsWithBodies);
@@ -237,7 +242,13 @@
if (Record[i+1] != ParamAttr::None)
Attrs.push_back(ParamAttrsWithIndex::get(Record[i], Record[i+1]));
}
- ParamAttrs.push_back(Attrs.empty() ? NULL : ParamAttrsList::get(Attrs));
+ if (Attrs.empty()) {
+ ParamAttrs.push_back(0);
+ } else {
+ ParamAttrs.push_back(ParamAttrsList::get(Attrs));
+ ParamAttrs.back()->addRef();
+ }
+
Attrs.clear();
break;
}
More information about the llvm-commits
mailing list