summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2017-05-03 10:00:00 +0000
committerPavel Labath <labath@google.com>2017-05-03 10:00:00 +0000
commit9075f52c7870378df4fba594595b1c51354ec097 (patch)
tree00f866c05d5f7c466acaea9fcaa1cd00a45e73d4
parentc60b4510ea6db9726fd4870381ca8486d862e9b8 (diff)
downloadbcm5719-llvm-9075f52c7870378df4fba594595b1c51354ec097.tar.gz
bcm5719-llvm-9075f52c7870378df4fba594595b1c51354ec097.zip
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 Reviewed By: clayborg Subscribers: labath, lldb-commits Differential Revision: https://reviews.llvm.org/D32708 Patch by Scott Smith <scott.smith@purestorage.com>. llvm-svn: 302008
-rw-r--r--lldb/source/Symbol/Symtab.cpp35
1 files changed, 17 insertions, 18 deletions
diff --git a/lldb/source/Symbol/Symtab.cpp b/lldb/source/Symbol/Symtab.cpp
index 1e241df0d90..e0710aa4e6b 100644
--- a/lldb/source/Symbol/Symtab.cpp
+++ b/lldb/source/Symbol/Symtab.cpp
@@ -299,17 +299,24 @@ void Symtab::InitNameIndexes() {
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 @@ 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);
}
}
}
OpenPOWER on IntegriCloud