From 66658e4dff51664a53c56dd729b8abe4d57aadef Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Tue, 31 May 2011 23:30:30 +0000 Subject: [PATCH] Refactor. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132373 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp | 15 ++++++++------- lib/CodeGen/AsmPrinter/DwarfCompileUnit.h | 4 +--- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp index 5016c43aebe..f128308fb6d 100644 --- a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp @@ -609,10 +609,16 @@ void CompileUnit::addType(DIE *Entity, DIType Ty) { // If this is a complete composite type then include it in the // list of global types. + addGlobalType(Ty, Entry->getEntry()); +} + +/// addGlobalType - Add a new global type to the compile unit. +/// +void CompileUnit::addGlobalType(DIType Ty, DIE *Die) { DIDescriptor Context = Ty.getContext(); if (Ty.isCompositeType() && !Ty.getName().empty() && !Ty.isForwardDecl() && (Context.isCompileUnit() || Context.isFile() || Context.isNameSpace())) - addGlobalType(Ty.getName(), Entry->getEntry()); + GlobalTypes[Ty.getName()] = Die; } /// addPubTypes - Add type for pubtypes section. @@ -627,12 +633,7 @@ void CompileUnit::addPubTypes(DISubprogram SP) { DIType ATy(Args.getElement(i)); if (!ATy.Verify()) continue; - DICompositeType CATy = getDICompositeType(ATy); - if (DIDescriptor(CATy).Verify() && !CATy.getName().empty() - && !CATy.isForwardDecl()) { - if (DIEEntry *Entry = getDIEEntry(CATy)) - addGlobalType(CATy.getName(), Entry->getEntry()); - } + addGlobalType(ATy, getDIEEntry(ATy)->getEntry()); } } diff --git a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h index 2edca8954b3..3cfbd73ef82 100644 --- a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h +++ b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h @@ -87,9 +87,7 @@ public: /// addGlobalType - Add a new global type to the compile unit. /// - void addGlobalType(StringRef Name, DIE *Die) { - GlobalTypes[Name] = Die; - } + void addGlobalType(DIType Ty, DIE *Die); /// getDIE - Returns the debug information entry map slot for the /// specified debug variable. -- 2.34.1