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);
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;
}
break;
}
// ALIAS: [alias type, aliasee val#, linkage]
+ // ALIAS: [alias type, aliasee val#, linkage, visibility]
case bitc::MODULE_CODE_ALIAS: {
if (Record.size() < 3)
return Error("Invalid MODULE_ALIAS record");
GlobalAlias *NewGA = new GlobalAlias(Ty, GetDecodedLinkage(Record[2]),
"", 0, TheModule);
+ // Old bitcode files didn't have visibility field.
+ if (Record.size() > 3)
+ NewGA->setVisibility(GetDecodedVisibility(Record[3]));
ValueList.push_back(NewGA);
AliasInits.push_back(std::make_pair(NewGA, Record[1]));
break;