Debug Info: remove form from function addDIEEntry.

The form must be a reference form in addDIEEntry. Which reference form to
use will be decided by the callee.

No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192517 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Manman Ren 2013-10-11 23:58:05 +00:00
parent 4bad07fbec
commit 87b110ac24
3 changed files with 17 additions and 26 deletions

View File

@ -226,9 +226,9 @@ void CompileUnit::addDelta(DIE *Die, uint16_t Attribute, uint16_t Form,
/// addDIEEntry - Add a DIE attribute data and value. /// addDIEEntry - Add a DIE attribute data and value.
/// ///
void CompileUnit::addDIEEntry(DIE *Die, uint16_t Attribute, uint16_t Form, void CompileUnit::addDIEEntry(DIE *Die, uint16_t Attribute, DIE *Entry) {
DIE *Entry) { // We currently only use ref4.
Die->addValue(Attribute, Form, createDIEEntry(Entry)); Die->addValue(Attribute, dwarf::DW_FORM_ref4, createDIEEntry(Entry));
} }
/// addBlock - Add block data. /// addBlock - Add block data.
@ -982,7 +982,7 @@ void CompileUnit::constructTypeDIE(DIE &Buffer, DIDerivedType DTy) {
addUInt(&Buffer, dwarf::DW_AT_byte_size, 0, Size); addUInt(&Buffer, dwarf::DW_AT_byte_size, 0, Size);
if (Tag == dwarf::DW_TAG_ptr_to_member_type) if (Tag == dwarf::DW_TAG_ptr_to_member_type)
addDIEEntry(&Buffer, dwarf::DW_AT_containing_type, dwarf::DW_FORM_ref4, addDIEEntry(&Buffer, dwarf::DW_AT_containing_type,
getOrCreateTypeDIE(resolve(DTy.getClassType()))); getOrCreateTypeDIE(resolve(DTy.getClassType())));
// Add source line info if available and TyDesc is not a forward declaration. // Add source line info if available and TyDesc is not a forward declaration.
if (!DTy.isForwardDecl()) if (!DTy.isForwardDecl())
@ -1162,7 +1162,7 @@ void CompileUnit::constructTypeDIE(DIE &Buffer, DICompositeType CTy) {
DICompositeType ContainingType(resolve(CTy.getContainingType())); DICompositeType ContainingType(resolve(CTy.getContainingType()));
if (DIDescriptor(ContainingType).isCompositeType()) if (DIDescriptor(ContainingType).isCompositeType())
addDIEEntry(&Buffer, dwarf::DW_AT_containing_type, dwarf::DW_FORM_ref4, addDIEEntry(&Buffer, dwarf::DW_AT_containing_type,
getOrCreateTypeDIE(DIType(ContainingType))); getOrCreateTypeDIE(DIType(ContainingType)));
if (CTy.isObjcClassComplete()) if (CTy.isObjcClassComplete())
@ -1329,8 +1329,7 @@ DIE *CompileUnit::getOrCreateSubprogramDIE(DISubprogram SP) {
// then there is no need to add other attributes. // then there is no need to add other attributes.
if (DeclDie) { if (DeclDie) {
// Refer function declaration directly. // Refer function declaration directly.
addDIEEntry(SPDie, dwarf::DW_AT_specification, dwarf::DW_FORM_ref4, addDIEEntry(SPDie, dwarf::DW_AT_specification, DeclDie);
DeclDie);
return SPDie; return SPDie;
} }
@ -1523,8 +1522,7 @@ void CompileUnit::createGlobalVariableDIE(const MDNode *N) {
!GVContext.isFile() && !DD->isSubprogramContext(GVContext)) { !GVContext.isFile() && !DD->isSubprogramContext(GVContext)) {
// Create specification DIE. // Create specification DIE.
VariableSpecDIE = new DIE(dwarf::DW_TAG_variable); VariableSpecDIE = new DIE(dwarf::DW_TAG_variable);
addDIEEntry(VariableSpecDIE, dwarf::DW_AT_specification, addDIEEntry(VariableSpecDIE, dwarf::DW_AT_specification, VariableDIE);
dwarf::DW_FORM_ref4, VariableDIE);
addBlock(VariableSpecDIE, dwarf::DW_AT_location, 0, Block); addBlock(VariableSpecDIE, dwarf::DW_AT_location, 0, Block);
// A static member's declaration is already flagged as such. // A static member's declaration is already flagged as such.
if (!SDMDecl.Verify()) if (!SDMDecl.Verify())
@ -1578,7 +1576,7 @@ void CompileUnit::createGlobalVariableDIE(const MDNode *N) {
void CompileUnit::constructSubrangeDIE(DIE &Buffer, DISubrange SR, void CompileUnit::constructSubrangeDIE(DIE &Buffer, DISubrange SR,
DIE *IndexTy) { DIE *IndexTy) {
DIE *DW_Subrange = new DIE(dwarf::DW_TAG_subrange_type); DIE *DW_Subrange = new DIE(dwarf::DW_TAG_subrange_type);
addDIEEntry(DW_Subrange, dwarf::DW_AT_type, dwarf::DW_FORM_ref4, IndexTy); addDIEEntry(DW_Subrange, dwarf::DW_AT_type, IndexTy);
// The LowerBound value defines the lower bounds which is typically zero for // The LowerBound value defines the lower bounds which is typically zero for
// C/C++. The Count value is the number of elements. Values are 64 bit. If // C/C++. The Count value is the number of elements. Values are 64 bit. If
@ -1654,7 +1652,7 @@ void CompileUnit::constructContainingTypeDIEs() {
if (!N) continue; if (!N) continue;
DIE *NDie = getDIE(N); DIE *NDie = getDIE(N);
if (!NDie) continue; if (!NDie) continue;
addDIEEntry(SPDie, dwarf::DW_AT_containing_type, dwarf::DW_FORM_ref4, NDie); addDIEEntry(SPDie, dwarf::DW_AT_containing_type, NDie);
} }
} }
@ -1668,8 +1666,7 @@ DIE *CompileUnit::constructVariableDIE(DbgVariable *DV,
DbgVariable *AbsVar = DV->getAbstractVariable(); DbgVariable *AbsVar = DV->getAbstractVariable();
DIE *AbsDIE = AbsVar ? AbsVar->getDIE() : NULL; DIE *AbsDIE = AbsVar ? AbsVar->getDIE() : NULL;
if (AbsDIE) if (AbsDIE)
addDIEEntry(VariableDie, dwarf::DW_AT_abstract_origin, addDIEEntry(VariableDie, dwarf::DW_AT_abstract_origin, AbsDIE);
dwarf::DW_FORM_ref4, AbsDIE);
else { else {
if (!Name.empty()) if (!Name.empty())
addString(VariableDie, dwarf::DW_AT_name, Name); addString(VariableDie, dwarf::DW_AT_name, Name);

View File

@ -207,7 +207,7 @@ public:
/// addDIEEntry - Add a DIE attribute data and value. /// addDIEEntry - Add a DIE attribute data and value.
/// ///
void addDIEEntry(DIE *Die, uint16_t Attribute, uint16_t Form, DIE *Entry); void addDIEEntry(DIE *Die, uint16_t Attribute, DIE *Entry);
/// addBlock - Add block data. /// addBlock - Add block data.
/// ///

View File

@ -382,8 +382,7 @@ DIE *DwarfDebug::updateSubprogramScopeDIE(CompileUnit *SPCU,
if (DIE *AbsSPDIE = AbstractSPDies.lookup(SPNode)) { if (DIE *AbsSPDIE = AbstractSPDies.lookup(SPNode)) {
// Pick up abstract subprogram DIE. // Pick up abstract subprogram DIE.
SPDie = new DIE(dwarf::DW_TAG_subprogram); SPDie = new DIE(dwarf::DW_TAG_subprogram);
SPCU->addDIEEntry(SPDie, dwarf::DW_AT_abstract_origin, SPCU->addDIEEntry(SPDie, dwarf::DW_AT_abstract_origin, AbsSPDIE);
dwarf::DW_FORM_ref4, AbsSPDIE);
SPCU->addDie(SPDie); SPCU->addDie(SPDie);
} else { } else {
DISubprogram SPDecl = SP.getFunctionDeclaration(); DISubprogram SPDecl = SP.getFunctionDeclaration();
@ -411,14 +410,12 @@ DIE *DwarfDebug::updateSubprogramScopeDIE(CompileUnit *SPCU,
if (ATy.isArtificial()) if (ATy.isArtificial())
SPCU->addFlag(Arg, dwarf::DW_AT_artificial); SPCU->addFlag(Arg, dwarf::DW_AT_artificial);
if (ATy.isObjectPointer()) if (ATy.isObjectPointer())
SPCU->addDIEEntry(SPDie, dwarf::DW_AT_object_pointer, SPCU->addDIEEntry(SPDie, dwarf::DW_AT_object_pointer, Arg);
dwarf::DW_FORM_ref4, Arg);
SPDie->addChild(Arg); SPDie->addChild(Arg);
} }
DIE *SPDeclDie = SPDie; DIE *SPDeclDie = SPDie;
SPDie = new DIE(dwarf::DW_TAG_subprogram); SPDie = new DIE(dwarf::DW_TAG_subprogram);
SPCU->addDIEEntry(SPDie, dwarf::DW_AT_specification, SPCU->addDIEEntry(SPDie, dwarf::DW_AT_specification, SPDeclDie);
dwarf::DW_FORM_ref4, SPDeclDie);
SPCU->addDie(SPDie); SPCU->addDie(SPDie);
} }
} }
@ -528,8 +525,7 @@ DIE *DwarfDebug::constructInlinedScopeDIE(CompileUnit *TheCU,
} }
DIE *ScopeDIE = new DIE(dwarf::DW_TAG_inlined_subroutine); DIE *ScopeDIE = new DIE(dwarf::DW_TAG_inlined_subroutine);
TheCU->addDIEEntry(ScopeDIE, dwarf::DW_AT_abstract_origin, TheCU->addDIEEntry(ScopeDIE, dwarf::DW_AT_abstract_origin, OriginDIE);
dwarf::DW_FORM_ref4, OriginDIE);
if (Ranges.size() > 1) { if (Ranges.size() > 1) {
// .debug_range section has not been laid out yet. Emit offset in // .debug_range section has not been laid out yet. Emit offset in
@ -674,8 +670,7 @@ DIE *DwarfDebug::constructScopeDIE(CompileUnit *TheCU, LexicalScope *Scope) {
ScopeDIE->addChild(*I); ScopeDIE->addChild(*I);
if (DS.isSubprogram() && ObjectPointer != NULL) if (DS.isSubprogram() && ObjectPointer != NULL)
TheCU->addDIEEntry(ScopeDIE, dwarf::DW_AT_object_pointer, TheCU->addDIEEntry(ScopeDIE, dwarf::DW_AT_object_pointer, ObjectPointer);
dwarf::DW_FORM_ref4, ObjectPointer);
if (DS.isSubprogram()) if (DS.isSubprogram())
TheCU->addPubTypes(DISubprogram(DS)); TheCU->addPubTypes(DISubprogram(DS));
@ -893,8 +888,7 @@ void DwarfDebug::constructImportedEntityDIE(CompileUnit *TheCU,
TheCU->getUniqueID()); TheCU->getUniqueID());
TheCU->addUInt(IMDie, dwarf::DW_AT_decl_file, 0, FileID); TheCU->addUInt(IMDie, dwarf::DW_AT_decl_file, 0, FileID);
TheCU->addUInt(IMDie, dwarf::DW_AT_decl_line, 0, Module.getLineNumber()); TheCU->addUInt(IMDie, dwarf::DW_AT_decl_line, 0, Module.getLineNumber());
TheCU->addDIEEntry(IMDie, dwarf::DW_AT_import, dwarf::DW_FORM_ref4, TheCU->addDIEEntry(IMDie, dwarf::DW_AT_import, EntityDie);
EntityDie);
StringRef Name = Module.getName(); StringRef Name = Module.getName();
if (!Name.empty()) if (!Name.empty())
TheCU->addString(IMDie, dwarf::DW_AT_name, Name); TheCU->addString(IMDie, dwarf::DW_AT_name, Name);