[Lldb-commits] [PATCH] D50071: Use rich mangling information in Symtab::InitNameIndexes()

Stefan Gränitz via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Aug 3 08:33:06 PDT 2018

sgraenitz added inline comments.

Comment at: source/Core/RichManglingInfo.cpp:69-80
+const char *RichManglingInfo::GetFunctionBaseName() const {
+  switch (m_provider) {
+  case ItaniumPartialDemangler:
+    if (auto buf = m_IPD->getFunctionBaseName(m_IPD_buf, &m_IPD_size)) {
+      m_IPD_buf = buf;
+      return buf;
+    }
labath wrote:
> Could these return `StringRef`? Am I correct in assuming that `m_IPD_size` holds the size of the returned string? If thats the case then you could even do this with no performance impact (or a positive one).
While investigating the `StringRef` issue, I realized another problem here. The second param `N` to the IPD queries is used to pass the **buffer size in** and the **string length out**. With the current use of `m_IPD_size` I pass ever smaller buffer sizes in subsequent calls. That causes unnecessary reallocs. I should track the length out param separately.

Comment at: source/Symbol/Symtab.cpp:397
+  // The base name will be our entry's name.
+  entry.cstring = ConstString(base_name.data());
labath wrote:
> remove `.data()`
Actually, this is dangerous as `StringRef` doesn't guarantee null termination. Will fix that.


More information about the lldb-commits mailing list