<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal">Hi,<o:p></o:p></p>
<p class="MsoNormal">It looks like Clang FE does not treat imported entities list (“imports”) as a set that has no duplication.<o:p></o:p></p>
<p class="MsoNormal">In the below simple example, imported entities list contains a duplication for same DIImportedEntity, which will end up having duplication of this imported entity in the dwarf debug info section (see below).
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Should "imports" list in DICompileUnit have duplication of DIImportedEntity?<o:p></o:p></p>
<p class="MsoNormal">Do you think we should fix Clang to assure the "imports" list is a unique set?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Notice that there is no added value to have the same entity duplicated!<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks,<br>
Amjad<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The example (using the attached files):<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Command-line: clang -cc1 -S -emit-llvm -o - -debug-info-kind=limited TestIM.cpp<br>
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.9.0 (trunk 261634) (llvm/trunk 261633)", isOptimized: false, runtimeVersion: 0, emissionKind: 1, enums: !2, imports: !3)<br>
!1 = !DIFile(filename: " <stdin>", directory: "\\")<br>
!2 = !{}<br>
!3 = !{!4, !4} <---------------------------- Bug: same entity appears twice in the imported entities list!<br>
!4 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !5, entity: !7, line: 8)<br>
!5 = !DINamespace(name: "Y", scope: null, file: !6, line: 7)<br>
<br>
<br>
<o:p></o:p></p>
<p class="MsoNormal">Command-line: clang -cc1 -S -emit-obj -o - -debug-info-kind=limited TestIM.cpp | llvm-dwarfdump.exe -debug-dump=info –<o:p></o:p></p>
<p class="MsoNormal">0x0000000b: DW_TAG_compile_unit [1] *<o:p></o:p></p>
<p class="MsoNormal"> DW_AT_producer [DW_FORM_strp] ( .debug_str[0x00000000] = "clang version 3.9.0 (trunk 259349) (llvm/trunk 259357)")<o:p></o:p></p>
<p class="MsoNormal"> DW_AT_language [DW_FORM_data2] (DW_LANG_C_plus_plus)<o:p></o:p></p>
<p class="MsoNormal"> DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000037] = " <stdin>")<o:p></o:p></p>
<p class="MsoNormal"> DW_AT_stmt_list [DW_FORM_sec_offset] (0x00000000)<o:p></o:p></p>
<p class="MsoNormal"> DW_AT_comp_dir [DW_FORM_strp] ( .debug_str[0x0000004e] = " \\ ")<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">0x0000001e: DW_TAG_namespace [2] *<o:p></o:p></p>
<p class="MsoNormal"> DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000074] = "Y")<o:p></o:p></p>
<p class="MsoNormal"> DW_AT_decl_file [DW_FORM_data1] ("TestIM.h")<o:p></o:p></p>
<p class="MsoNormal"> DW_AT_decl_line [DW_FORM_data1] (7)<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">0x00000025: DW_TAG_imported_declaration [3]<o:p></o:p></p>
<p class="MsoNormal"> DW_AT_decl_file [DW_FORM_data1] ("TestIM.h")<o:p></o:p></p>
<p class="MsoNormal"> DW_AT_decl_line [DW_FORM_data1] (8)<o:p></o:p></p>
<p class="MsoNormal"> DW_AT_import [DW_FORM_ref4] (cu + 0x003b => {0x0000003b})<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">0x0000002c: DW_TAG_imported_declaration [3] <---------------------------- duplication of 0x00000025<o:p></o:p></p>
<p class="MsoNormal"> DW_AT_decl_file [DW_FORM_data1] ("TestIM.h")<o:p></o:p></p>
<p class="MsoNormal"> DW_AT_decl_line [DW_FORM_data1] (8)<o:p></o:p></p>
<p class="MsoNormal"> DW_AT_import [DW_FORM_ref4] (cu + 0x003b => {0x0000003b})<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">0x00000033: NULL<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p>---------------------------------------------------------------------<br>
Intel Israel (74) Limited</p>
<p>This e-mail and any attachments may contain confidential material for<br>
the sole use of the intended recipient(s). Any review or distribution<br>
by others is strictly prohibited. If you are not the intended<br>
recipient, please contact the sender and delete all copies.</p></body>
</html>