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

Stefan Gränitz via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Jul 30 08:24:10 PDT 2018


sgraenitz added inline comments.


================
Comment at: include/lldb/Symbol/Symtab.h:43
+private:
+  enum InfoProvider { ItaniumPartialDemangler, PluginCxxLanguage };
+
----------------
We don't need a None-case here.


================
Comment at: include/lldb/Symbol/Symtab.h:58
+  /// dependency. Keep a void* here instead and cast it on-demand on the cpp.
+  void *m_legacy_parser = nullptr;
+
----------------
This is the hackiest point I guess.


================
Comment at: include/lldb/Symbol/Symtab.h:106
+//----------------------------------------------------------------------
+
 class Symtab {
----------------
^^^^^ May have its own header & cpp


================
Comment at: include/lldb/Utility/ConstString.h:357
+
   //------------------------------------------------------------------
   /// Set the C string value.
----------------
Fixing a related issue: There is no way to determine whether or not the internal string is null or empty. In fact, `operator!` does the same as the above `IsEmpty()`. The `Mangled::GetDemangledName()` function, however, thinks there would be a difference and wants to benefit from it. The fixed version should be correct now.


================
Comment at: source/Core/Mangled.cpp:198
       a.GetName(lldb::eLanguageTypeUnknown, ePreferMangled),
-      a.GetName(lldb::eLanguageTypeUnknown, ePreferMangled));
+      b.GetName(lldb::eLanguageTypeUnknown, ePreferMangled));
 }
----------------
Fixing bug: This is no dead code, but well, maybe in a rare branch.


================
Comment at: source/Core/Mangled.cpp:366
   // already decoded our mangled name.
-  if (m_mangled && !m_demangled) {
+  if (m_mangled && m_demangled.IsNull()) {
     // We need to generate and cache the demangled name.
----------------
Using the difference between null and empty.


================
Comment at: source/Core/Mangled.cpp:397
     }
-    if (!m_demangled) {
+    if (m_demangled.IsNull()) {
       // Set the demangled string to the empty string to indicate we tried to
----------------
Using the difference between null and empty.


================
Comment at: source/Symbol/Symtab.cpp:295
+namespace {
+bool lldb_skip_name(const char *mangled_cstr, Mangled::ManglingScheme scheme) {
+  switch (scheme) {
----------------
This uses a raw C-string instead of `llvm::StringRef` in order to achieve `O(1)` runtime.


https://reviews.llvm.org/D49990





More information about the lldb-commits mailing list