<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Oct 4, 2013 at 5:27 PM, Eric Christopher <span dir="ltr"><<a href="mailto:echristo@gmail.com" target="_blank">echristo@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: echristo<br>
Date: Fri Oct 4 19:27:02 2013<br>
New Revision: 192014<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=192014&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=192014&view=rev</a><br>
Log:<br>
Add a resolve method on CompileUnit that forwards to DwarfDebug.<br>
<br>
Modified:<br>
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp<br>
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp?rev=192014&r1=192013&r2=192014&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp?rev=192014&r1=192013&r2=192014&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Fri Oct 4 19:27:02 2013<br>
@@ -807,7 +807,7 @@ DIE *CompileUnit::getOrCreateTypeDIE(con<br>
addAccelType(Ty.getName(), std::make_pair(TyDIE, Flags));<br>
}<br>
<br>
- addToContextOwner(TyDIE, DD->resolve(Ty.getContext()));<br>
+ addToContextOwner(TyDIE, resolve(Ty.getContext()));<br>
return TyDIE;<br>
}<br>
<br>
@@ -872,7 +872,7 @@ void CompileUnit::addGlobalName(StringRe<br>
/// addGlobalType - Add a new global type to the compile unit.<br>
///<br>
void CompileUnit::addGlobalType(DIType Ty) {<br>
- DIScope Context = DD->resolve(Ty.getContext());<br>
+ DIScope Context = resolve(Ty.getContext());<br>
if (!Ty.getName().empty() && !Ty.isForwardDecl() &&<br>
(!Context || Context.isCompileUnit() || Context.isFile() ||<br>
Context.isNameSpace()))<br>
@@ -937,7 +937,7 @@ void CompileUnit::constructTypeDIE(DIE &<br>
<br>
if (Tag == dwarf::DW_TAG_ptr_to_member_type)<br>
addDIEEntry(&Buffer, dwarf::DW_AT_containing_type, dwarf::DW_FORM_ref4,<br>
- getOrCreateTypeDIE(DD->resolve(DTy.getClassType())));<br>
+ getOrCreateTypeDIE(resolve(DTy.getClassType())));<br>
// Add source line info if available and TyDesc is not a forward declaration.<br>
if (!DTy.isForwardDecl())<br>
addSourceLine(&Buffer, DTy);<br>
@@ -1113,7 +1113,7 @@ void CompileUnit::constructTypeDIE(DIE &<br>
if (CTy.isAppleBlockExtension())<br>
addFlag(&Buffer, dwarf::DW_AT_APPLE_block);<br>
<br>
- DICompositeType ContainingType(DD->resolve(CTy.getContainingType()));<br>
+ DICompositeType ContainingType(resolve(CTy.getContainingType()));<br>
if (DIDescriptor(ContainingType).isCompositeType())<br>
addDIEEntry(&Buffer, dwarf::DW_AT_containing_type, dwarf::DW_FORM_ref4,<br>
getOrCreateTypeDIE(DIType(ContainingType)));<br>
@@ -1325,7 +1325,7 @@ DIE *CompileUnit::getOrCreateSubprogramD<br>
addUInt(Block, 0, dwarf::DW_FORM_udata, SP.getVirtualIndex());<br>
addBlock(SPDie, dwarf::DW_AT_vtable_elem_location, 0, Block);<br>
ContainingTypeMap.insert(std::make_pair(SPDie,<br>
- DD->resolve(SP.getContainingType())));<br>
+ resolve(SP.getContainingType())));<br>
}<br>
<br>
if (!SP.isDefinition()) {<br>
@@ -1409,7 +1409,7 @@ void CompileUnit::createGlobalVariableDI<br>
// We need the declaration DIE that is in the static member's class.<br>
// But that class might not exist in the DWARF yet.<br>
// Creating the class will create the static member decl DIE.<br>
- getOrCreateContextDIE(DD->resolve(SDMDecl.getContext()));<br>
+ getOrCreateContextDIE(resolve(SDMDecl.getContext()));<br>
VariableDIE = getDIE(SDMDecl);<br>
assert(VariableDIE && "Static member decl has no context?");<br>
IsStaticMember = true;<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h?rev=192014&r1=192013&r2=192014&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h?rev=192014&r1=192013&r2=192014&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h Fri Oct 4 19:27:02 2013<br>
@@ -15,6 +15,7 @@<br>
#define CODEGEN_ASMPRINTER_DWARFCOMPILEUNIT_H<br>
<br>
#include "DIE.h"<br>
+#include "DwarfDebug.h"<br>
#include "llvm/ADT/DenseMap.h"<br>
#include "llvm/ADT/OwningPtr.h"<br>
#include "llvm/ADT/StringMap.h"<br>
@@ -23,8 +24,6 @@<br>
<br>
namespace llvm {<br>
<br>
-class DwarfDebug;<br>
-class DwarfUnits;<br>
class MachineLocation;<br>
class MachineOperand;<br>
class ConstantInt;<br>
@@ -353,6 +352,12 @@ private:<br>
/// information entry.<br>
DIEEntry *createDIEEntry(DIE *Entry);<br>
<br>
+ /// resolve - Look in the DwarfDebug map for the MDNode that<br>
+ /// corresponds to a scope reference.<br></blockquote><div><br></div><div>DIRef handles both scopes and types (hence the template) so this comment is a little over-constrained, but I'm not too fussed.</div><div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ template <typename T> T resolve(DIRef<T> Ref) const {<br>
+ return DD->resolve(Ref);<br>
+ }<br>
+<br>
private:<br>
<br>
// DIEValueAllocator - All DIEValues are allocated through this allocator.<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div></div>