<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Is there a more convenient way to obtain a DIType given a Type than matching up the strings for the names?</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">For example, given:</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"></p>
<div>struct S {<br>
  int x, y;<br>
} s;<br>
<br>
void foo(S *a) {<br>
  a->x = 0;<br>
  a->y = 1;<br>
}</div>
<p></p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">There are DIType nodes for the struct Type:</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"></p>
<div>!6 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "S", file: !3, line: 1, size: 64, flags: DIFlagTypePassByValue, elements: !7, identifier: "_ZTS1S")<br>
!7 = !{!8, !10}<br>
!8 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !6, file: !3, line: 2, baseType: !9, size: 32)<br>
!9 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)<br>
!10 = !DIDerivedType(tag: DW_TAG_member, name: "y", scope: !6, file: !3, line: 2, baseType: !9, size: 32, offset: 32)</div>
<br>
<p></p>
<p style="margin-top:0;margin-bottom:0">but given just the StructType for S there is no direct way to get to the DICompositeType.  I've made something work by prescanning all the DITypes in my Module and creating a map that uses type names as the key, being
 careful to strip "struct." prefixes and maintain scoping for nested structs (e.g., S1::S2), which works, but seems awfully complicated to need to do.</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Seems like StructType should have a getMetaData() function, but I don't see one.</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">-Troy<br>
</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
</div>
</body>
</html>