<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Jan 17, 2018, at 6:20 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com" class="">dblaikie@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Yeah +1 for not making a new CU if we can help it.<br class=""><br class="">Also wondering about the name of this function - giving it the same name as the original seems like it'd create issues for debuggers?<br class=""><br class="">What exactly is outlining - it's taking a chunk of a function and pulling it out into another function? I guess we already pick an interesting mangled name for it to be unique and should probably use that? (maybe only put the linkage name and not give it a non-linkage name? Since it doesn't have a name in the source... but not sure if LLVM really supports a nameless function (or if DWARF/debuggers are cool with that either?))<br class=""></div></div></blockquote><div><br class=""></div><div>Somewhat off-topic, but this made me curious how LLVM represents a C++ lambda in DWARF:</div><div><br class=""></div><div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); font-size: 11px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">$ cat /tmp/lambda.cpp</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); font-size: 11px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">int f() {</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); font-size: 11px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  auto l = [](){return 0;};</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); font-size: 11px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  return l();</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); font-size: 11px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">}</span></div><div style="font-size: 10px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><br class=""></span></div><div style="font-size: 10px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">--></span></div></div><div style="font-size: 10px;"><br class=""></div><div style="font-size: 10px;"><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(82, 48, 225); background-color: rgb(255, 255, 255); font-size: 11px;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #afad24" class="">0x00000059: </span><span style="font-variant-ligatures: no-common-ligatures" class="">      DW_TAG_subprogram</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); font-size: 11px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">                    </span><span style="font-variant-ligatures: no-common-ligatures; color: #33bbc8" class="">DW_AT_name</span><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">    </span>("operator()")</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); font-size: 11px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">                    </span><span style="font-variant-ligatures: no-common-ligatures; color: #33bbc8" class="">DW_AT_decl_file</span><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">  </span>(</span><span style="font-variant-ligatures: no-common-ligatures; color: #34bc26" class="">"/tmp/lambda.cpp"</span><span style="font-variant-ligatures: no-common-ligatures" class="">)</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); font-size: 11px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">                    </span><span style="font-variant-ligatures: no-common-ligatures; color: #33bbc8" class="">DW_AT_decl_line</span><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre"> </span>(2)</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); font-size: 11px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">                    </span><span style="font-variant-ligatures: no-common-ligatures; color: #33bbc8" class="">DW_AT_type</span><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">    </span>(cu + 0x006d "int")</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); font-size: 11px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">                    </span><span style="font-variant-ligatures: no-common-ligatures; color: #33bbc8" class="">DW_AT_declaration</span><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">   </span>(true)</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); font-size: 11px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">                    </span><span style="font-variant-ligatures: no-common-ligatures; color: #33bbc8" class="">DW_AT_external</span><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">     </span>(true)</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); font-size: 11px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">                    </span><span style="font-variant-ligatures: no-common-ligatures; color: #33bbc8" class="">DW_AT_accessibility</span><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>(</span><span style="font-variant-ligatures: no-common-ligatures; color: #d53bd3" class="">DW_ACCESS_public</span><span style="font-variant-ligatures: no-common-ligatures" class="">)</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); font-size: 11px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div></div><div style="font-size: 10px;"><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(82, 48, 225); background-color: rgb(255, 255, 255);" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #afad24" class="">0x0000007e: </span><span style="font-variant-ligatures: no-common-ligatures" class="">  DW_TAG_subprogram</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(0, 0, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">                </span><span style="font-variant-ligatures: no-common-ligatures; color: #33bbc8" class="">DW_AT_low_pc</span><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">   </span>(0x0000000000000020)</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(0, 0, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">                </span><span style="font-variant-ligatures: no-common-ligatures; color: #33bbc8" class="">DW_AT_high_pc</span><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">    </span>(0x000000000000002c)</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(0, 0, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">                </span><span style="font-variant-ligatures: no-common-ligatures; color: #33bbc8" class="">DW_AT_frame_base</span><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre"> </span>(DW_OP_reg6 RBP)</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(0, 0, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">                </span><span style="font-variant-ligatures: no-common-ligatures; color: #33bbc8" class="">DW_AT_object_pointer</span><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre"> </span>(cu + 0x0099)</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(0, 0, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">                </span><span style="font-variant-ligatures: no-common-ligatures; color: #33bbc8" class="">DW_AT_linkage_name</span><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">      </span>("_ZZ1fvENK3$_0clEv")</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(0, 0, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">                </span><span style="font-variant-ligatures: no-common-ligatures; color: #33bbc8" class="">DW_AT_specification</span><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">   </span>(cu + 0x0059 "operator()")</span></div></div></div><div><br class=""></div><div><br class=""></div><div>On-topic: If an empty human-readable name does not work, just putting the linkage name there would be fine, I think.</div><div><br class=""></div><div>-- adrian</div></div></body></html>