message: Check for lack of C++ context first when demangling
  Summary: It seems that if we have no context, then it can't possibly be a method.  Check that first.
  Reviewers: clayborg
  Subscribers: labath, lldb-commits
  Patch by Scott Smith
diff: @@ -299,6 +299,14 @@ void Symtab::InitNameIndexes() {
  const char *const_context =
  ConstString(cxx_method.GetContext()).GetCString();
  + 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 {
  entry_ref = entry.cstring.GetStringRef();
  if (entry_ref[0] == '~' ||
  !cxx_method.GetQualifiers().empty()) {
  @@ -309,7 +317,6 @@ void Symtab::InitNameIndexes() {
  class_contexts.insert(const_context);
  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
  @@ -326,14 +333,6 @@ void Symtab::InitNameIndexes() {
  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);
  }
  }
  }
  