<html><body><div style="color:#000; background-color:#fff; font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:12pt"><div style="font-size: 12pt; font-family: 'Courier New', courier, monaco, monospace, sans-serif;">Hi Stefanus,</div><div style="font-size: 12pt; font-family: 'Courier New', courier, monaco, monospace, sans-serif;"><br></div><div style="font-size: 16px; font-family: 'Courier New', courier, monaco, monospace, sans-serif; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;">Thanks for your response?</div><div style="font-family: 'Courier New', courier, monaco, monospace, sans-serif;"><div style="font-family: 'times new roman', 'new york', times, serif;"><div dir="ltr" style="font-size: 12pt; font-family: 'times new roman', 'new york', times, serif;"> </div> <div class="y_msg_container" style="font-size: 12pt; font-family: 'times new roman', 'new york', times, serif;"><br>
> 0. why in a C++ code, the C free function is used?<br><br>Because it's calling into a C API (cxxabi). demangled_name comes from a<br>call to abi::__cxa_demangle(), which presumably calls malloc to allocate<br>its return value.</div><div class="y_msg_container" style="font-size: 12pt; font-family: 'times new roman', 'new york', times, serif;"><br></div><div class="y_msg_container" style="font-size: 12pt; font-family: 'times new roman', 'new york', times, serif;">OK. Got that.</div><div class="y_msg_container" style="font-size: 12pt; font-family: 'times new roman', 'new york', times, serif;"><br><br>> 1. Why when using it, the #include <cstdlib> is nowhere in the source?<br><br>Mangled.cpp:25 is:<br>#include <stdlib.h><br><br>No. This is incorrect. With lldb 3.3 official release tar ball, the #include that you mentioned is not there.<br><br></div><div class="y_msg_container" style="font-size: 12pt;"><span style="font-family: 'Courier
New', courier, monaco, monospace, sans-serif;"><span style="color: rgb(64, 127, 0);">zackp@nb1:~/Downloads/c</span><wbr><span style="color: rgb(64, 127, 0);">lang3.3/lldb-3.</span><wbr><span style="color: rgb(64, 127, 0);">3.src/source/Co</span><wbr><span style="color: rgb(64, 127, 0);">re$ grep stdlib.h Mangled.cpp</span><br><span style="font-weight: bold; color: rgb(255, 0, 0);">zackp@nb1:~/Downloads/c<wbr>lang3.3/lldb-3.<wbr>3.src/source/Co<wbr>re$</span></span></div><div class="y_msg_container" style="font-size: 12pt;"><span style="color: rgb(255, 0, 0); font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-weight: bold;"><br></span></div><div class="y_msg_container" style="font-size: 12pt;"><span style="font-family: 'Courier New', courier, monaco, monospace, sans-serif;">I patched it as follows:</span></div><div class="y_msg_container" style="font-size: 12pt;"><span style="font-family: 'Courier New', courier, monaco, monospace,
sans-serif;"><br></span></div><div class="y_msg_container"><span><div class="y_msg_container"><span style="font-family: 'Courier New', courier, monaco, monospace, sans-serif;"> 11 #if defined(__APPLE__)</span></div><div class="y_msg_container"><span style="font-family: 'Courier New', courier, monaco, monospace, sans-serif;"> 12 #define USE_BUILTIN_LIBCXXABI_DEMANGLER 1</span></div><div class="y_msg_container"><span style="font-family: 'Courier New', courier, monaco, monospace, sans-serif;"> 13 #endif</span></div><div class="y_msg_container"><span style="font-family: 'Courier New', courier, monaco, monospace, sans-serif;"> 14 </span></div><div class="y_msg_container"><span style="font-family: 'Courier New', courier, monaco, monospace, sans-serif;"> 15 #if defined(USE_BUILTIN_LIBCXXABI_DEMANGLER)</span></div><div class="y_msg_container"><span style="font-family:
'Courier New', courier, monaco, monospace, sans-serif;"> 16 #include "lldb/Core/cxa_demangle.h"</span></div><div class="y_msg_container"><span style="font-family: 'Courier New', courier, monaco, monospace, sans-serif;"> 17 #else</span></div><div class="y_msg_container"><span style="font-family: 'Courier New', courier, monaco, monospace, sans-serif;"> 18 // FreeBSD9-STABLE requires this to know about size_t in cxxabi.h</span></div><div class="y_msg_container"><span style="font-family: 'Courier New', courier, monaco, monospace, sans-serif;"> 19 #include <cstddef></span></div><div class="y_msg_container"><span style="font-family: 'Courier New', courier, monaco, monospace, sans-serif;"> 20 #include <cxxabi.h></span></div><div class="y_msg_container"><span style="font-family: 'Courier New', courier, monaco, monospace, sans-serif;"> 21
#endif</span></div><div class="y_msg_container"><span style="font-family: 'Courier New', courier, monaco, monospace, sans-serif;"> 22 </span></div><div class="y_msg_container"><span style="font-family: 'Courier New', courier, monaco, monospace, sans-serif;"> 23 <span style="font-weight: bold;"> #include <cstdlib></span></span></div><div class="y_msg_container"><span style="font-family: 'Courier New', courier, monaco, monospace, sans-serif;"> 24 #include "llvm/ADT/DenseMap.h"</span></div><div class="y_msg_container"><span style="font-family: 'Courier New', courier, monaco, monospace, sans-serif;"><br></span></div><div class="y_msg_container"><span style="font-family: arial, helvetica, sans-serif;">My personal style is that if I code in C++, I use as much as possible C++ coding convention.</span></div><div class="y_msg_container"><span style="font-family: arial, helvetica,
sans-serif;"><br></span></div><div class="y_msg_container"><span style="font-family: arial, helvetica, sans-serif;">Regards,</span></div><div class="y_msg_container"><span style="font-family: arial, helvetica, sans-serif;"><br></span></div><div class="y_msg_container"><span style="font-family: arial, helvetica, sans-serif;">-- Zack</span></div></span><span style="font-family: arial, helvetica, sans-serif;">[...]</span></div> </div> </div> </div></body></html>