> 0. why in a C++ code, the C free function is used? Because it's calling into a C API (cxxabi). demangled_name comes from a call to abi::__cxa_demangle(), which presumably calls malloc to allocate its return value.
> 1. Why when using it, the #include <cstdlib> is nowhere in the source? Mangled.cpp:25 is: #include <stdlib.h> -- Stefanus Du Toit <[email protected]> Intel Waterloo From: Zack Perry <[email protected]> Reply-To: Zack Perry <[email protected]> Date: Thursday, 15 August, 2013 12:41 PM To: "[email protected]" <[email protected]> Subject: [lldb-dev] Using a undeclared free function in lldb Mangled.cpp causes build failure I am trying to build lldb on a Ubuntu 12.04 x86_64 box. I have a self-hosted clang 3.3 toolchain successfully built and installed on this box. So, I thought it would be simple just add a symlink lldb to the lldb-3.3-src into the llvm/tools/, redo the configure, make, and make install would do it. Not really! zackp@nb1:~/Downloads/clang3.3/build$ ../llvm/configure --prefix=/usr --enable-optimized --disable-assertions --enable-targets=host-only --enable-cxx11=yes --enable-libcpp=yes --with-extra-ld-options="-lc++abi" zackp@nb1:~/Downloads/clang3.3/build$ make -j 2 [...] llvm[4]: Compiling Mangled.cpp for Release build /home/zackp/Downloads/clang3.3/llvm-3.3.src/tools/lldb/source/Core/Mangled. cpp:218:21: error: use of undeclared identifier 'free' free (demangled_name); ^ 1 error generated. make[4]: *** [/home/zackp/Downloads/clang3.3/build/tools/lldb/source/Core/Release/Mangle d.o] Error 1 make[4]: *** Waiting for unfinished jobs.... make[4]: Leaving directory `/home/zackp/Downloads/clang3.3/build/tools/lldb/source/Core' make[3]: *** [all] Error 1 make[3]: Leaving directory `/home/zackp/Downloads/clang3.3/build/tools/lldb/source' make[2]: *** [all] Error 1 make[2]: Leaving directory `/home/zackp/Downloads/clang3.3/build/tools/lldb' make[1]: *** [all] Error 1 make[1]: Leaving directory `/home/zackp/Downloads/clang3.3/build/tools' make: *** [all] Error 1 Questions: 0. why in a C++ code, the C free function is used? 1. Why when using it, the #include <cstdlib> is nowhere in the source? Regards, -- Zack _______________________________________________ lldb-dev mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
