aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Core
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Core')
-rw-r--r--lldb/source/Core/Mangled.cpp21
-rw-r--r--lldb/source/Core/RichManglingContext.cpp46
2 files changed, 26 insertions, 41 deletions
diff --git a/lldb/source/Core/Mangled.cpp b/lldb/source/Core/Mangled.cpp
index 4e10324401dc..b8e405544b33 100644
--- a/lldb/source/Core/Mangled.cpp
+++ b/lldb/source/Core/Mangled.cpp
@@ -195,8 +195,8 @@ static char *GetDLangDemangledStr(const char *M) {
// Explicit demangling for scheduled requests during batch processing. This
// makes use of ItaniumPartialDemangler's rich demangle info
-bool Mangled::DemangleWithRichManglingInfo(
- RichManglingContext &context, SkipMangledNameFn *skip_mangled_name) {
+bool Mangled::GetRichManglingInfo(RichManglingContext &context,
+ SkipMangledNameFn *skip_mangled_name) {
// Others are not meant to arrive here. ObjC names or C's main() for example
// have their names stored in m_demangled, while m_mangled is empty.
assert(m_mangled);
@@ -214,25 +214,16 @@ bool Mangled::DemangleWithRichManglingInfo(
case eManglingSchemeItanium:
// We want the rich mangling info here, so we don't care whether or not
// there is a demangled string in the pool already.
- if (context.FromItaniumName(m_mangled)) {
- // If we got an info, we have a name. Copy to string pool and connect the
- // counterparts to accelerate later access in GetDemangledName().
- context.ParseFullName();
- m_demangled.SetStringWithMangledCounterpart(context.GetBufferRef(),
- m_mangled);
- return true;
- } else {
- m_demangled.SetCString("");
- return false;
- }
+ return context.FromItaniumName(m_mangled);
case eManglingSchemeMSVC: {
// We have no rich mangling for MSVC-mangled names yet, so first try to
// demangle it if necessary.
if (!m_demangled && !m_mangled.GetMangledCounterpart(m_demangled)) {
if (char *d = GetMSVCDemangledStr(m_mangled.GetCString())) {
- // If we got an info, we have a name. Copy to string pool and connect
- // the counterparts to accelerate later access in GetDemangledName().
+ // Without the rich mangling info we have to demangle the full name.
+ // Copy it to string pool and connect the counterparts to accelerate
+ // later access in GetDemangledName().
m_demangled.SetStringWithMangledCounterpart(llvm::StringRef(d),
m_mangled);
::free(d);
diff --git a/lldb/source/Core/RichManglingContext.cpp b/lldb/source/Core/RichManglingContext.cpp
index 63170feb6231..cecb5c6a2e54 100644
--- a/lldb/source/Core/RichManglingContext.cpp
+++ b/lldb/source/Core/RichManglingContext.cpp
@@ -83,15 +83,15 @@ bool RichManglingContext::IsCtorOrDtor() const {
llvm_unreachable("Fully covered switch above!");
}
-void RichManglingContext::processIPDStrResult(char *ipd_res, size_t res_size) {
+llvm::StringRef RichManglingContext::processIPDStrResult(char *ipd_res,
+ size_t res_size) {
// Error case: Clear the buffer.
if (LLVM_UNLIKELY(ipd_res == nullptr)) {
assert(res_size == m_ipd_buf_size &&
"Failed IPD queries keep the original size in the N parameter");
m_ipd_buf[0] = '\0';
- m_buffer = llvm::StringRef(m_ipd_buf, 0);
- return;
+ return llvm::StringRef(m_ipd_buf, 0);
}
// IPD's res_size includes null terminator.
@@ -109,60 +109,54 @@ void RichManglingContext::processIPDStrResult(char *ipd_res, size_t res_size) {
}
// 99% case: Just remember the string length.
- m_buffer = llvm::StringRef(m_ipd_buf, res_size - 1);
+ return llvm::StringRef(m_ipd_buf, res_size - 1);
}
-void RichManglingContext::ParseFunctionBaseName() {
+llvm::StringRef RichManglingContext::ParseFunctionBaseName() {
assert(m_provider != None && "Initialize a provider first");
switch (m_provider) {
case ItaniumPartialDemangler: {
auto n = m_ipd_buf_size;
auto buf = m_ipd.getFunctionBaseName(m_ipd_buf, &n);
- processIPDStrResult(buf, n);
- return;
+ return processIPDStrResult(buf, n);
}
case PluginCxxLanguage:
- m_buffer =
- get<CPlusPlusLanguage::MethodName>(m_cxx_method_parser)->GetBasename();
- return;
+ return get<CPlusPlusLanguage::MethodName>(m_cxx_method_parser)
+ ->GetBasename();
case None:
- return;
+ return {};
}
}
-void RichManglingContext::ParseFunctionDeclContextName() {
+llvm::StringRef RichManglingContext::ParseFunctionDeclContextName() {
assert(m_provider != None && "Initialize a provider first");
switch (m_provider) {
case ItaniumPartialDemangler: {
auto n = m_ipd_buf_size;
auto buf = m_ipd.getFunctionDeclContextName(m_ipd_buf, &n);
- processIPDStrResult(buf, n);
- return;
+ return processIPDStrResult(buf, n);
}
case PluginCxxLanguage:
- m_buffer =
- get<CPlusPlusLanguage::MethodName>(m_cxx_method_parser)->GetContext();
- return;
+ return get<CPlusPlusLanguage::MethodName>(m_cxx_method_parser)
+ ->GetContext();
case None:
- return;
+ return {};
}
}
-void RichManglingContext::ParseFullName() {
+llvm::StringRef RichManglingContext::ParseFullName() {
assert(m_provider != None && "Initialize a provider first");
switch (m_provider) {
case ItaniumPartialDemangler: {
auto n = m_ipd_buf_size;
auto buf = m_ipd.finishDemangle(m_ipd_buf, &n);
- processIPDStrResult(buf, n);
- return;
+ return processIPDStrResult(buf, n);
}
case PluginCxxLanguage:
- m_buffer = get<CPlusPlusLanguage::MethodName>(m_cxx_method_parser)
- ->GetFullName()
- .GetStringRef();
- return;
+ return get<CPlusPlusLanguage::MethodName>(m_cxx_method_parser)
+ ->GetFullName()
+ .GetStringRef();
case None:
- return;
+ return {};
}
}