1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00

Do not forget debug info for enums. Use named mdnode to keep track of these types.

llvm-svn: 110712
This commit is contained in:
Devang Patel 2010-08-10 20:01:20 +00:00
parent eb15b8b44d
commit 9b12559c4f
2 changed files with 20 additions and 2 deletions

View File

@ -923,7 +923,14 @@ DICompositeType DIFactory::CreateCompositeType(unsigned Tag,
ConstantInt::get(Type::getInt32Ty(VMContext), RuntimeLang),
ContainingType
};
return DICompositeType(MDNode::get(VMContext, &Elts[0], 13));
MDNode *Node = MDNode::get(VMContext, &Elts[0], 13);
// Create a named metadata so that we do not lose this enum info.
if (Tag == dwarf::DW_TAG_enumeration_type) {
NamedMDNode *NMD = M.getOrInsertNamedMetadata("llvm.dbg.enum");
NMD->addOperand(Node);
}
return DICompositeType(Node);
}
@ -955,7 +962,13 @@ DICompositeType DIFactory::CreateCompositeTypeEx(unsigned Tag,
Elements,
ConstantInt::get(Type::getInt32Ty(VMContext), RuntimeLang)
};
return DICompositeType(MDNode::get(VMContext, &Elts[0], 12));
MDNode *Node = MDNode::get(VMContext, &Elts[0], 12);
// Create a named metadata so that we do not lose this enum info.
if (Tag == dwarf::DW_TAG_enumeration_type) {
NamedMDNode *NMD = M.getOrInsertNamedMetadata("llvm.dbg.enum");
NMD->addOperand(Node);
}
return DICompositeType(Node);
}

View File

@ -2019,6 +2019,11 @@ void DwarfDebug::beginModule(Module *M) {
E = DbgFinder.global_variable_end(); I != E; ++I)
constructGlobalVariableDIE(*I);
//getOrCreateTypeDIE
if (NamedMDNode *NMD = M->getNamedMetadata("llvm.dbg.enum"))
for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i)
getOrCreateTypeDIE(DIType(NMD->getOperand(i)));
// Prime section data.
SectionMap.insert(Asm->getObjFileLowering().getTextSection());