<div dir="ltr">Yep - given this source code:<br><br>struct foo {<br>  static auto f1();<br>};<br>auto foo::f1() {<br>  return 3;<br>}<br><br>The current LLVM IR generated is:<br>!7 = distinct !DISubprogram(name: "f1", linkageName: "_ZN3foo2f1Ev", scope: !8, file: !1, line: 4, type: !9, scopeLine: 4, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, declaration: !12, retainedNodes: !2)<br>!8 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "foo", file: !1, line: 1, size: 8, flags: DIFlagTypePassByValue, elements: !2, identifier: "_ZTS3foo")<br>!9 = !DISubroutineType(types: !10)<br>!10 = !{!11}<br>!11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)<br>!12 = !DISubprogram(name: "f1", linkageName: "_ZN3foo2f1Ev", scope: !8, file: !1, line: 2, type: !9, scopeLine: 2, flags: DIFlagPrototyped | DIFlagStaticMember, spFlags: 0)<br><br>But instead of that, if we're going to support using DW_AT_unspecified_type for auto and emitting declarations of auto functions even if there's no definition available (which, again, I don't think is super important/necessary by any means), the DWARF should look like this:<br><br>!7 = distinct !DISubprogram(name: "f1", linkageName: "_ZN3foo2f1Ev", scope: !8, file: !1, line: 4, type: !9, scopeLine: 4, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, declaration: !12, retainedNodes: !2)<br>!8 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "foo", file: !1, line: 1, size: 8, flags: DIFlagTypePassByValue, <b>elements: !13</b>, identifier: "_ZTS3foo")<br>!9 = !DISubroutineType(types: !10)<br>!10 = !{!11}<br>!11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)<br>!12 = !DISubprogram(name: "f1", linkageName: "_ZN3foo2f1Ev", scope: !8, file: !1, line: 2, <b>type: !14</b>, scopeLine: 2, flags: DIFlagPrototyped | DIFlagStaticMember, spFlags: 0)<br><b>!13 = !{!12}<br>!14 = !DISubroutineType(types: !15)<br>!15 = {!16}<br>!16 = DIBasicType(tag: DW_TAG_unspecified_type, name: "auto")<br></b></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Dec 26, 2019 at 10:11 PM Awanish Pandey via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Dear all,<div><br></div><div>I want to handle auto return type feature in the clang. The objective of this task is to store <i>auto </i>as the program return type in the declaration DIE and the actual return type in the definition DIE. Currently, clang only dumps actual return type in the declaration DIE. </div><div>Based on my understanding I need two store two return types (auto for declaration and actual for definition). Is there any other way to tackle this scenario?</div><div><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div><div><div>Thanking You<br></div>Awanish Pandey<br></div>PhD, CSE<br></div>IIT Kanpur<br></div></div></div></div></div></div>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div>