[Debug Info] unique MDNodes in the enum types of each compile unit.

The enum types array by design contains pointers to MDNodes rather than DIRefs.
Unique them when handling the enum types in DwarfDebug.

rdar://17628609


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214139 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Manman Ren
2014-07-28 23:04:20 +00:00
parent 6514cc5cb5
commit 2bd885aa97
2 changed files with 85 additions and 2 deletions

View File

@ -762,8 +762,13 @@ void DwarfDebug::beginModule() {
for (unsigned i = 0, e = SPs.getNumElements(); i != e; ++i)
SPMap.insert(std::make_pair(SPs.getElement(i), &CU));
DIArray EnumTypes = CUNode.getEnumTypes();
for (unsigned i = 0, e = EnumTypes.getNumElements(); i != e; ++i)
CU.getOrCreateTypeDIE(EnumTypes.getElement(i));
for (unsigned i = 0, e = EnumTypes.getNumElements(); i != e; ++i) {
DIType Ty(EnumTypes.getElement(i));
// The enum types array by design contains pointers to
// MDNodes rather than DIRefs. Unique them here.
DIType UniqueTy(resolve(Ty.getRef()));
CU.getOrCreateTypeDIE(UniqueTy);
}
DIArray RetainedTypes = CUNode.getRetainedTypes();
for (unsigned i = 0, e = RetainedTypes.getNumElements(); i != e; ++i) {
DIType Ty(RetainedTypes.getElement(i));