DIBuilder: add trackIfUnresolved() to all nodes that may be cyclic.

Tested in clang/test/CodeGenObjCCXX/debug-info-cyclic.mm

rdar://problem/19839612

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229521 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Adrian Prantl 2015-02-17 19:17:39 +00:00
parent 602706ee58
commit 07d4ebdc92

View File

@ -414,7 +414,6 @@ DIDerivedType DIBuilder::createInheritance(DIType Ty, DIType BaseTy,
.get(VMContext), .get(VMContext),
nullptr, Ty.getRef(), BaseTy.getRef()}; nullptr, Ty.getRef(), BaseTy.getRef()};
auto R = DIDerivedType(MDNode::get(VMContext, Elts)); auto R = DIDerivedType(MDNode::get(VMContext, Elts));
trackIfUnresolved(R);
return R; return R;
} }
@ -581,6 +580,7 @@ DICompositeType DIBuilder::createClassType(DIDescriptor Context, StringRef Name,
"createClassType should return a DICompositeType"); "createClassType should return a DICompositeType");
if (!UniqueIdentifier.empty()) if (!UniqueIdentifier.empty())
retainType(R); retainType(R);
trackIfUnresolved(R);
return R; return R;
} }
@ -614,6 +614,7 @@ DICompositeType DIBuilder::createStructType(DIDescriptor Context,
"createStructType should return a DICompositeType"); "createStructType should return a DICompositeType");
if (!UniqueIdentifier.empty()) if (!UniqueIdentifier.empty())
retainType(R); retainType(R);
trackIfUnresolved(R);
return R; return R;
} }
@ -642,6 +643,7 @@ DICompositeType DIBuilder::createUnionType(DIDescriptor Scope, StringRef Name,
DICompositeType R(MDNode::get(VMContext, Elts)); DICompositeType R(MDNode::get(VMContext, Elts));
if (!UniqueIdentifier.empty()) if (!UniqueIdentifier.empty())
retainType(R); retainType(R);
trackIfUnresolved(R);
return R; return R;
} }
@ -688,6 +690,7 @@ DICompositeType DIBuilder::createEnumerationType(
AllEnumTypes.push_back(CTy); AllEnumTypes.push_back(CTy);
if (!UniqueIdentifier.empty()) if (!UniqueIdentifier.empty())
retainType(CTy); retainType(CTy);
trackIfUnresolved(CTy);
return CTy; return CTy;
} }
@ -709,7 +712,9 @@ DICompositeType DIBuilder::createArrayType(uint64_t Size, uint64_t AlignInBits,
Ty.getRef(), Subscripts, nullptr, nullptr, Ty.getRef(), Subscripts, nullptr, nullptr,
nullptr // Type Identifer nullptr // Type Identifer
}; };
return DICompositeType(MDNode::get(VMContext, Elts)); DICompositeType R(MDNode::get(VMContext, Elts));
trackIfUnresolved(R);
return R;
} }
DICompositeType DIBuilder::createVectorType(uint64_t Size, uint64_t AlignInBits, DICompositeType DIBuilder::createVectorType(uint64_t Size, uint64_t AlignInBits,
@ -730,7 +735,9 @@ DICompositeType DIBuilder::createVectorType(uint64_t Size, uint64_t AlignInBits,
Ty.getRef(), Subscripts, nullptr, nullptr, Ty.getRef(), Subscripts, nullptr, nullptr,
nullptr // Type Identifer nullptr // Type Identifer
}; };
return DICompositeType(MDNode::get(VMContext, Elts)); DICompositeType R(MDNode::get(VMContext, Elts));
trackIfUnresolved(R);
return R;
} }
static HeaderBuilder setTypeFlagsInHeader(StringRef Header, static HeaderBuilder setTypeFlagsInHeader(StringRef Header,
@ -807,6 +814,7 @@ DIBuilder::createForwardDecl(unsigned Tag, StringRef Name, DIDescriptor Scope,
"createForwardDecl result should be a DIType"); "createForwardDecl result should be a DIType");
if (!UniqueIdentifier.empty()) if (!UniqueIdentifier.empty())
retainType(RetTy); retainType(RetTy);
trackIfUnresolved(RetTy);
return RetTy; return RetTy;
} }
@ -835,6 +843,7 @@ DICompositeType DIBuilder::createReplaceableCompositeType(
"createReplaceableForwardDecl result should be a DIType"); "createReplaceableForwardDecl result should be a DIType");
if (!UniqueIdentifier.empty()) if (!UniqueIdentifier.empty())
retainType(RetTy); retainType(RetTy);
trackIfUnresolved(RetTy);
return RetTy; return RetTy;
} }
@ -1025,6 +1034,7 @@ DISubprogram DIBuilder::createFunction(DIDescriptor Context, StringRef Name,
// do not lose this mdnode. // do not lose this mdnode.
if (isDefinition) if (isDefinition)
AllSubprograms.push_back(Node); AllSubprograms.push_back(Node);
trackIfUnresolved(Node);
return Node; return Node;
}); });
} }
@ -1080,6 +1090,7 @@ DISubprogram DIBuilder::createMethod(DIDescriptor Context, StringRef Name,
AllSubprograms.push_back(Node); AllSubprograms.push_back(Node);
DISubprogram S(Node); DISubprogram S(Node);
assert(S.isSubprogram() && "createMethod should return a valid DISubprogram"); assert(S.isSubprogram() && "createMethod should return a valid DISubprogram");
trackIfUnresolved(S);
return S; return S;
} }