Skip to content

Commit

Permalink
Add a resolve method on CompileUnit that forwards to DwarfDebug.
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192014 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
echristo committed Oct 5, 2013
1 parent eacbfd1 commit eee74fb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
12 changes: 6 additions & 6 deletions lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ DIE *CompileUnit::getOrCreateTypeDIE(const MDNode *TyNode) {
addAccelType(Ty.getName(), std::make_pair(TyDIE, Flags));
}

addToContextOwner(TyDIE, DD->resolve(Ty.getContext()));
addToContextOwner(TyDIE, resolve(Ty.getContext()));
return TyDIE;
}

Expand Down Expand Up @@ -872,7 +872,7 @@ void CompileUnit::addGlobalName(StringRef Name, DIE *Die) {
/// addGlobalType - Add a new global type to the compile unit.
///
void CompileUnit::addGlobalType(DIType Ty) {
DIScope Context = DD->resolve(Ty.getContext());
DIScope Context = resolve(Ty.getContext());
if (!Ty.getName().empty() && !Ty.isForwardDecl() &&
(!Context || Context.isCompileUnit() || Context.isFile() ||
Context.isNameSpace()))
Expand Down Expand Up @@ -937,7 +937,7 @@ void CompileUnit::constructTypeDIE(DIE &Buffer, DIDerivedType DTy) {

if (Tag == dwarf::DW_TAG_ptr_to_member_type)
addDIEEntry(&Buffer, dwarf::DW_AT_containing_type, dwarf::DW_FORM_ref4,
getOrCreateTypeDIE(DD->resolve(DTy.getClassType())));
getOrCreateTypeDIE(resolve(DTy.getClassType())));
// Add source line info if available and TyDesc is not a forward declaration.
if (!DTy.isForwardDecl())
addSourceLine(&Buffer, DTy);
Expand Down Expand Up @@ -1113,7 +1113,7 @@ void CompileUnit::constructTypeDIE(DIE &Buffer, DICompositeType CTy) {
if (CTy.isAppleBlockExtension())
addFlag(&Buffer, dwarf::DW_AT_APPLE_block);

DICompositeType ContainingType(DD->resolve(CTy.getContainingType()));
DICompositeType ContainingType(resolve(CTy.getContainingType()));
if (DIDescriptor(ContainingType).isCompositeType())
addDIEEntry(&Buffer, dwarf::DW_AT_containing_type, dwarf::DW_FORM_ref4,
getOrCreateTypeDIE(DIType(ContainingType)));
Expand Down Expand Up @@ -1325,7 +1325,7 @@ DIE *CompileUnit::getOrCreateSubprogramDIE(DISubprogram SP) {
addUInt(Block, 0, dwarf::DW_FORM_udata, SP.getVirtualIndex());
addBlock(SPDie, dwarf::DW_AT_vtable_elem_location, 0, Block);
ContainingTypeMap.insert(std::make_pair(SPDie,
DD->resolve(SP.getContainingType())));
resolve(SP.getContainingType())));
}

if (!SP.isDefinition()) {
Expand Down Expand Up @@ -1409,7 +1409,7 @@ void CompileUnit::createGlobalVariableDIE(const MDNode *N) {
// We need the declaration DIE that is in the static member's class.
// But that class might not exist in the DWARF yet.
// Creating the class will create the static member decl DIE.
getOrCreateContextDIE(DD->resolve(SDMDecl.getContext()));
getOrCreateContextDIE(resolve(SDMDecl.getContext()));
VariableDIE = getDIE(SDMDecl);
assert(VariableDIE && "Static member decl has no context?");
IsStaticMember = true;
Expand Down
9 changes: 7 additions & 2 deletions lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#define CODEGEN_ASMPRINTER_DWARFCOMPILEUNIT_H

#include "DIE.h"
#include "DwarfDebug.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/StringMap.h"
Expand All @@ -23,8 +24,6 @@

namespace llvm {

class DwarfDebug;
class DwarfUnits;
class MachineLocation;
class MachineOperand;
class ConstantInt;
Expand Down Expand Up @@ -353,6 +352,12 @@ class CompileUnit {
/// information entry.
DIEEntry *createDIEEntry(DIE *Entry);

/// resolve - Look in the DwarfDebug map for the MDNode that
/// corresponds to a scope reference.
template <typename T> T resolve(DIRef<T> Ref) const {
return DD->resolve(Ref);
}

private:

// DIEValueAllocator - All DIEValues are allocated through this allocator.
Expand Down

0 comments on commit eee74fb

Please sign in to comment.