<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">The situation is not consistent. Yes there are several places where we have the #if in the headers however there are far more cases where it is not. Some points here:</div><div class=""><br class=""></div><div class="">- This whole LLVM_DUMP_FUNCTION/LLVM_ENABLE_DUMP is about enabling the linker to strip (or not strip) the dumping function in release (debug) builds.</div><div class="">- For this it doesn't matter whether you have a declaration in the header or not, so it seems we standardized on not having it there.</div><div class="">- Things are 100% consistent so we sometimes have #ifs anyway.</div><div class="">- In case of templates we not only have the declaration but also an implementation in the header and need the #if there</div><div class="">- A similar problem arises in cases where the dump function was declared virtual and ends up in the vtable</div><div class="">- If you ask me then we shouldn't have LLVM_ENABLE_DUMP and just rely on NDEBUG to keep things simple... (We're in this strange state anyway where LLVM_ENABLE_DEBUG isn't even exposed as a cmake option).</div><div class="">- Either way, putting LLVM_ENABLE_DUMP into config.h would make the status-quo more consistent.</div><div class=""><br class=""></div><div class="">- Matthias</div><div class=""><br class=""></div><div><blockquote type="cite" class=""><div class="">On Apr 10, 2017, at 12:17 PM, Chris Bieneman <<a href="mailto:beanz@apple.com" class="">beanz@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Presently several of our headers have definitions like:<div class=""><br class=""></div><div class=""><div class="">#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)</div><div class="">  void dump() const;</div><div class="">#endif</div></div><div class=""><br class=""></div><div class="">Would it make sense to modify the build system to define LLVM_ENABLE_DUMP in config.h on debug builds?</div><div class=""><br class=""></div><div class="">Then we could wrap dump methods just based on LLVM_ENABLE_DUMP instead of two variables.</div><div class=""><br class=""></div><div class="">-Chris</div><div class=""><br class=""></div><div class=""><div class=""><blockquote type="cite" class=""><div class="">On Apr 10, 2017, at 1:34 PM, Robinson, Paul via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">-----Original Message-----<br class="">From: llvm-dev [<a href="mailto:llvm-dev-bounces@lists.llvm.org" class="">mailto:llvm-dev-bounces@lists.llvm.org</a>] On Behalf Of Mehdi<br class="">Amini via llvm-dev<br class="">Sent: Sunday, April 09, 2017 2:26 PM<br class="">To: Matthias Braun<br class="">Cc:<span class="Apple-converted-space"> </span><a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>;<span class="Apple-converted-space"> </span><a href="mailto:jingu@codeplay.com" class="">jingu@codeplay.com</a><br class="">Subject: Re: [llvm-dev] Question about LLVM Building Error with "-<br class="">DLLVM_ENABLE_DUMP" and "RelWithDebInfo"<br class=""><br class=""><br class=""><blockquote type="cite" class="">On Apr 7, 2017, at 4:45 PM, Matthias Braun via llvm-dev <llvm-<br class=""></blockquote><a href="mailto:dev@lists.llvm.org" class="">dev@lists.llvm.org</a>> wrote:<br class=""><blockquote type="cite" class=""><br class="">I think the idea is to keep NDEBUG out of headers when possible. So I<br class=""></blockquote>think this should better be something like:<br class=""><blockquote type="cite" class=""><br class="">-#ifndef NDEBUG<br class=""> void dumpUses(unsigned RegNo) const;<br class="">-#endif<br class=""><br class="">to be inline with various other dumpers (like MachineInstr::dump(),<br class=""></blockquote>Pass::dump(), …)<br class=""><br class="">I’m fine with leaving methods there, but we need to be able to compile-out<br class="">fields in structure.<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Hmmm seems to me this has come up in the past, and somebody pointed out</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">that it prevents building a debug-mode front-end against a release-mode LLVM.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">(Why is that a valid use-case?  If I have an out-of-tree front end, and</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">especially one with a different license, I might well prefer to download</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">only LLVM releases rather than keep up-to-date with a live tree that I</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">build myself.  IIRC we do not provide debug-mode downloads, therefore<span class="Apple-converted-space"> </span></span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">anything that affects struct size/layout will break this use-case.)</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">--paulr</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class=""><br class="">We already have ABI_BREAKING_CHECKS for instance to this end, the naming<br class="">isn’t completely in line with LLVM_ENABLE_DUMP but could be unified.<br class=""><br class="">—<br class="">Mehdi<br class=""><br class=""><br class=""><blockquote type="cite" class=""><br class="">If that works for you please submit a patch to phabricator as described<br class=""></blockquote>in <a href="http://llvm.org/docs/DeveloperPolicy.html#making-and-submitting-a-patch" class="">http://llvm.org/docs/DeveloperPolicy.html#making-and-submitting-a-patch</a><br class=""><blockquote type="cite" class=""><br class="">- Matthias<br class=""><br class=""><blockquote type="cite" class="">On Apr 6, 2017, at 7:38 AM, <a href="mailto:jingu@codeplay.com" class="">jingu@codeplay.com</a> via llvm-dev <llvm-<br class=""></blockquote></blockquote><a href="mailto:dev@lists.llvm.org" class="">dev@lists.llvm.org</a>> wrote:<br class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><br class="">Hi All,<br class=""><br class="">I have tried to build llvm tip as following:<br class=""><br class="">cmake -DCMAKE_CXX_FLAGS:STRING="-DLLVM_ENABLE_DUMP" -<br class=""></blockquote></blockquote>DCMAKE_BUILD_TYPE=RelWithDebInfo ../llvm<br class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><br class="">After running 'make', I have got error messages like below.<br class=""><br class="">llvm/lib/CodeGen/MachineRegisterInfo.cpp:462:67: error: no ‘void<br class=""></blockquote></blockquote>llvm::MachineRegisterInfo::dumpUses(unsigned int) const’ member function<br class="">declared in class ‘llvm::MachineRegisterInfo’<br class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><br class="">llvm/lib/CodeGen/MachineScheduler.cpp:2331:57: error: no ‘void<br class=""></blockquote></blockquote>llvm::SchedBoundary::dumpScheduledState()’ member function declared in<br class="">class ‘llvm::SchedBoundary’<br class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><br class="">...<br class=""><br class="">It seems the "defined(LLVM_ENABLE_DUMP)" is needed on several<br class=""></blockquote></blockquote>locations. How do you think about it? I have attached the diff file about<br class="">the locations for reference.  If I missed something, please let me know.<br class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><br class="">Thanks,<br class=""><br class="">JinGu Kang<br class=""><br class=""><dump.diff>_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br class=""></blockquote><br class="">_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br class=""></blockquote><br class="">_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br class=""></blockquote><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">_______________________________________________</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">LLVM Developers mailing list</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="mailto:llvm-dev@lists.llvm.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">llvm-dev@lists.llvm.org</a><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a></div></blockquote></div><br class=""></div></div></div></blockquote></div><br class=""></body></html>