sgraenitz added inline comments.

================
Comment at: source/Symbol/Symtab.cpp:274
+  case ItaniumPartialDemangler:
+    m_IPD_buf = m_IPD->getFunctionBaseName(m_IPD_buf, &m_IPD_size);
+    return m_IPD_buf;
----------------
erik.pilkington wrote:
> sgraenitz wrote:
> > @erik.pilkington Is it acceptable/good practice to pass `(nullptr, 0)` 
> > here? At the moment this safes some lines of initialization checks for 
> > `m_IPD_buf` and `m_IPD_size`.
> Sure, thats fine! Those parameters act the same way as `buf` and `size` in 
> __cxa_demangle.
> 
> `getFunctionBaseName` will return nullptr if the mangled name isn't a 
> function. Is it a precondition of this function that m_IPD stores a function? 
> If not, it looks like you'll leak the buffer.
Oh that is a very good note. I had it as a precondition in the client function 
in Symtab. When I removed that and started to just check the result for 
`nullptr`, I didn't think about the buffer. Gonna fix it, the generalized 
interface shouldn't have that precondition anyway. Thanks!


https://reviews.llvm.org/D49990



_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to