From 2ea848b972d7d3dc5c0e525ba2795941d10e7748 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Tue, 19 Nov 2013 22:51:04 +0000 Subject: DebugInfo: Constify accelerator table handling, and separate type accelarator insertion in preparation for a second use of this code from type units. llvm-svn: 195164 --- llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp | 28 ++++++++++++++---------- 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp') diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp index 25b9c1da1c4..fbd7ce82283 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp @@ -900,8 +900,13 @@ DIE *CompileUnit::getOrCreateTypeDIE(const MDNode *TyNode) { assert(Ty.isDerivedType() && "Unknown kind of DIType"); constructTypeDIE(*TyDIE, DIDerivedType(Ty)); } - // If this is a named finished type then include it in the list of types - // for the accelerator tables. + + updateAcceleratorTables(Ty, TyDIE); + + return TyDIE; +} + +void CompileUnit::updateAcceleratorTables(DIType Ty, const DIE *TyDIE) { if (!Ty.getName().empty() && !Ty.isForwardDecl()) { bool IsImplementation = 0; if (Ty.isCompositeType()) { @@ -913,8 +918,6 @@ DIE *CompileUnit::getOrCreateTypeDIE(const MDNode *TyNode) { unsigned Flags = IsImplementation ? dwarf::DW_FLAG_type_implementation : 0; addAccelType(Ty.getName(), std::make_pair(TyDIE, Flags)); } - - return TyDIE; } /// addType - Add a new type attribute to the specified entity. @@ -946,27 +949,28 @@ void CompileUnit::addType(DIE *Entity, DIType Ty, dwarf::Attribute Attribute) { // DIE to the proper table while ensuring that the name that we're going // to reference is in the string table. We do this since the names we // add may not only be identical to the names in the DIE. -void CompileUnit::addAccelName(StringRef Name, DIE *Die) { +void CompileUnit::addAccelName(StringRef Name, const DIE *Die) { DU->getStringPoolEntry(Name); - std::vector &DIEs = AccelNames[Name]; + std::vector &DIEs = AccelNames[Name]; DIEs.push_back(Die); } -void CompileUnit::addAccelObjC(StringRef Name, DIE *Die) { +void CompileUnit::addAccelObjC(StringRef Name, const DIE *Die) { DU->getStringPoolEntry(Name); - std::vector &DIEs = AccelObjC[Name]; + std::vector &DIEs = AccelObjC[Name]; DIEs.push_back(Die); } -void CompileUnit::addAccelNamespace(StringRef Name, DIE *Die) { +void CompileUnit::addAccelNamespace(StringRef Name, const DIE *Die) { DU->getStringPoolEntry(Name); - std::vector &DIEs = AccelNamespace[Name]; + std::vector &DIEs = AccelNamespace[Name]; DIEs.push_back(Die); } -void CompileUnit::addAccelType(StringRef Name, std::pair Die) { +void CompileUnit::addAccelType(StringRef Name, + std::pair Die) { DU->getStringPoolEntry(Name); - std::vector > &DIEs = AccelTypes[Name]; + std::vector > &DIEs = AccelTypes[Name]; DIEs.push_back(Die); } -- cgit v1.2.3