[Lldb-commits] [PATCH] D32708: Check for lack of C++ context first when demangling

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed May 3 03:13:06 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL302008: Check for lack of C++ context first when demangling (authored by labath).

Changed prior to commit:
  https://reviews.llvm.org/D32708?vs=97312&id=97579#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D32708

Files:
  lldb/trunk/source/Symbol/Symtab.cpp


Index: lldb/trunk/source/Symbol/Symtab.cpp
===================================================================
--- lldb/trunk/source/Symbol/Symtab.cpp
+++ lldb/trunk/source/Symbol/Symtab.cpp
@@ -299,17 +299,24 @@
               const char *const_context =
                   ConstString(cxx_method.GetContext()).GetCString();
 
-              entry_ref = entry.cstring.GetStringRef();
-              if (entry_ref[0] == '~' ||
-                  !cxx_method.GetQualifiers().empty()) {
-                // The first character of the demangled basename is '~' which
-                // means we have a class destructor. We can use this information
-                // to help us know what is a class and what isn't.
-                if (class_contexts.find(const_context) == class_contexts.end())
-                  class_contexts.insert(const_context);
-                m_method_to_index.Append(entry);
+              if (!const_context || const_context[0] == 0) {
+                // No context for this function so this has to be a basename
+                m_basename_to_index.Append(entry);
+                // If there is no context (no namespaces or class scopes that
+                // come before the function name) then this also could be a
+                // fullname.
+                m_name_to_index.Append(entry);
               } else {
-                if (const_context && const_context[0]) {
+                entry_ref = entry.cstring.GetStringRef();
+                if (entry_ref[0] == '~' ||
+                    !cxx_method.GetQualifiers().empty()) {
+                  // The first character of the demangled basename is '~' which
+                  // means we have a class destructor. We can use this information
+                  // to help us know what is a class and what isn't.
+                  if (class_contexts.find(const_context) == class_contexts.end())
+                    class_contexts.insert(const_context);
+                  m_method_to_index.Append(entry);
+                } else {
                   if (class_contexts.find(const_context) !=
                       class_contexts.end()) {
                     // The current decl context is in our "class_contexts" which
@@ -326,14 +333,6 @@
                     mangled_name_to_index.Append(entry);
                     symbol_contexts[entry.value] = const_context;
                   }
-                } else {
-                  // No context for this function so this has to be a basename
-                  m_basename_to_index.Append(entry);
-                  // If there is no context (no namespaces or class scopes that
-                  // come before the function name) then this also could be a
-                  // fullname.
-                  if (cxx_method.GetContext().empty())
-                    m_name_to_index.Append(entry);
                 }
               }
             }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32708.97579.patch
Type: text/x-patch
Size: 2896 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20170503/dc1c2190/attachment.bin>


More information about the lldb-commits mailing list