Index: source/Symbol/Symtab.cpp =================================================================== --- source/Symbol/Symtab.cpp +++ source/Symbol/Symtab.cpp @@ -310,22 +310,16 @@ m_method_to_index.Append(entry); } else { if (const_context && const_context[0]) { - if (class_contexts.find(const_context) != - class_contexts.end()) { - // The current decl context is in our "class_contexts" which - // means - // this is a method on a class - m_method_to_index.Append(entry); - } else { - // We don't know if this is a function basename or a method, - // so put it into a temporary collection so once we are done - // we can look in class_contexts to see if each entry is a - // class - // or just a function and will put any remaining items into - // m_method_to_index or m_basename_to_index as needed - mangled_name_to_index.Append(entry); - symbol_contexts[entry.value] = const_context; - } + // We don't know if this is a function basename or a method, + // so put it into a temporary collection so once we are done + // we can look in class_contexts to see if each entry is a + // class + // or just a function and will put any remaining items into + // m_method_to_index or m_basename_to_index as needed + mangled_name_to_index.Append(entry); + symbol_contexts[entry.value] = const_context; + // Note this is common to both paths, though + m_method_to_index.Append(entry); } else { // No context for this function so this has to be a basename m_basename_to_index.Append(entry); @@ -373,26 +367,19 @@ } } - size_t count; - if (!mangled_name_to_index.IsEmpty()) { - count = mangled_name_to_index.GetSize(); - for (size_t i = 0; i < count; ++i) { - if (mangled_name_to_index.GetValueAtIndex(i, entry.value)) { - entry.cstring = mangled_name_to_index.GetCStringAtIndex(i); - if (symbol_contexts[entry.value] && - class_contexts.find(symbol_contexts[entry.value]) != - class_contexts.end()) { - m_method_to_index.Append(entry); - } else { - // If we got here, we have something that had a context (was inside - // a namespace or class) - // yet we don't know if the entry - m_method_to_index.Append(entry); - m_basename_to_index.Append(entry); - } + size_t count = mangled_name_to_index.GetSize(); + for (size_t i = 0; i < count; ++i) { + if (mangled_name_to_index.GetValueAtIndex(i, entry.value)) { + entry.cstring = mangled_name_to_index.GetCStringAtIndex(i); + if (class_contexts.find(symbol_contexts[entry.value]) == + class_contexts.end()) { + // If we got here, we have something that had a context (was inside + // a namespace or class) yet we don't know if the entry + m_basename_to_index.Append(entry); } } } + m_name_to_index.Sort(); m_name_to_index.SizeToFit(); m_selector_to_index.Sort();