[llvm] r192014 - Add a resolve method on CompileUnit that forwards to DwarfDebug.

David Blaikie dblaikie at gmail.com
Fri Oct 4 17:33:04 PDT 2013


On Fri, Oct 4, 2013 at 5:27 PM, Eric Christopher <echristo at gmail.com> wrote:

> Author: echristo
> Date: Fri Oct  4 19:27:02 2013
> New Revision: 192014
>
> URL: http://llvm.org/viewvc/llvm-project?rev=192014&view=rev
> Log:
> Add a resolve method on CompileUnit that forwards to DwarfDebug.
>
> Modified:
>     llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
>     llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp?rev=192014&r1=192013&r2=192014&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Fri Oct  4
> 19:27:02 2013
> @@ -807,7 +807,7 @@ DIE *CompileUnit::getOrCreateTypeDIE(con
>      addAccelType(Ty.getName(), std::make_pair(TyDIE, Flags));
>    }
>
> -  addToContextOwner(TyDIE, DD->resolve(Ty.getContext()));
> +  addToContextOwner(TyDIE, resolve(Ty.getContext()));
>    return TyDIE;
>  }
>
> @@ -872,7 +872,7 @@ void CompileUnit::addGlobalName(StringRe
>  /// 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()))
> @@ -937,7 +937,7 @@ void CompileUnit::constructTypeDIE(DIE &
>
>    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);
> @@ -1113,7 +1113,7 @@ void CompileUnit::constructTypeDIE(DIE &
>      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)));
> @@ -1325,7 +1325,7 @@ DIE *CompileUnit::getOrCreateSubprogramD
>      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()) {
> @@ -1409,7 +1409,7 @@ void CompileUnit::createGlobalVariableDI
>      // 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;
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h?rev=192014&r1=192013&r2=192014&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h Fri Oct  4
> 19:27:02 2013
> @@ -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"
> @@ -23,8 +24,6 @@
>
>  namespace llvm {
>
> -class DwarfDebug;
> -class DwarfUnits;
>  class MachineLocation;
>  class MachineOperand;
>  class ConstantInt;
> @@ -353,6 +352,12 @@ private:
>    /// information entry.
>    DIEEntry *createDIEEntry(DIE *Entry);
>
> +  /// resolve - Look in the DwarfDebug map for the MDNode that
> +  /// corresponds to a scope reference.
>

DIRef handles both scopes and types (hence the template) so this comment is
a little over-constrained, but I'm not too fussed.


> +  template <typename T> T resolve(DIRef<T> Ref) const {
> +    return DD->resolve(Ref);
> +  }
> +
>  private:
>
>    // DIEValueAllocator - All DIEValues are allocated through this
> allocator.
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131004/6a6d6b65/attachment.html>


More information about the llvm-commits mailing list