mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-14 15:39:06 +00:00
Use WeakVH while storing metadata in containers.
This fixes PR5393. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86091 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a0e7b02760
commit
85b8de8118
@ -480,17 +480,17 @@ bool LLParser::ParseMDNode(MetadataBase *&Node) {
|
||||
if (ParseUInt32(MID)) return true;
|
||||
|
||||
// Check existing MDNode.
|
||||
std::map<unsigned, MetadataBase *>::iterator I = MetadataCache.find(MID);
|
||||
std::map<unsigned, WeakVH>::iterator I = MetadataCache.find(MID);
|
||||
if (I != MetadataCache.end()) {
|
||||
Node = I->second;
|
||||
Node = cast<MetadataBase>(I->second);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check known forward references.
|
||||
std::map<unsigned, std::pair<MetadataBase *, LocTy> >::iterator
|
||||
std::map<unsigned, std::pair<WeakVH, LocTy> >::iterator
|
||||
FI = ForwardRefMDNodes.find(MID);
|
||||
if (FI != ForwardRefMDNodes.end()) {
|
||||
Node = FI->second.first;
|
||||
Node = cast<MetadataBase>(FI->second.first);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -570,7 +570,7 @@ bool LLParser::ParseStandaloneMetadata() {
|
||||
|
||||
MDNode *Init = MDNode::get(Context, Elts.data(), Elts.size());
|
||||
MetadataCache[MetadataID] = Init;
|
||||
std::map<unsigned, std::pair<MetadataBase *, LocTy> >::iterator
|
||||
std::map<unsigned, std::pair<WeakVH, LocTy> >::iterator
|
||||
FI = ForwardRefMDNodes.find(MetadataID);
|
||||
if (FI != ForwardRefMDNodes.end()) {
|
||||
MDNode *FwdNode = cast<MDNode>(FI->second.first);
|
||||
|
@ -79,8 +79,8 @@ namespace llvm {
|
||||
std::map<unsigned, std::pair<PATypeHolder, LocTy> > ForwardRefTypeIDs;
|
||||
std::vector<PATypeHolder> NumberedTypes;
|
||||
/// MetadataCache - This map keeps track of parsed metadata constants.
|
||||
std::map<unsigned, MetadataBase *> MetadataCache;
|
||||
std::map<unsigned, std::pair<MetadataBase *, LocTy> > ForwardRefMDNodes;
|
||||
std::map<unsigned, WeakVH> MetadataCache;
|
||||
std::map<unsigned, std::pair<WeakVH, LocTy> > ForwardRefMDNodes;
|
||||
SmallVector<std::pair<unsigned, MDNode *>, 2> MDsOnInst;
|
||||
struct UpRefRecord {
|
||||
/// Loc - This is the location of the upref.
|
||||
|
Loading…
Reference in New Issue
Block a user