aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2016-08-18 08:21:38 +0000
committerPavel Labath <labath@google.com>2016-08-18 08:21:38 +0000
commit9361c439e8cef6fcc87edefbc3389ad1160984fd (patch)
treefe439cc09665f2c94650ee80761045963f9eebfc /lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
parent6ee4f905dce7c4fde389f8e06c89b463fcbf68ac (diff)
downloadllvm-9361c439e8cef6fcc87edefbc3389ad1160984fd.zip
llvm-9361c439e8cef6fcc87edefbc3389ad1160984fd.tar.gz
llvm-9361c439e8cef6fcc87edefbc3389ad1160984fd.tar.bz2
Fix parsing of complicated C++ names
Summary: CPlusPlusLanguage::MethodName was not correctly parsing templated functions whose demangled name included the return type -- the space before the function name was included in the "context" and the context itself was not terminated correctly due to a misuse of the substr function (second argument is length, not the end position). Fix that and add a regression test. Reviewers: clayborg Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D23608 llvm-svn: 279038
Diffstat (limited to 'lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp')
-rw-r--r--lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
index 33d22bf..0cd059e 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -220,6 +220,8 @@ CPlusPlusLanguage::MethodName::Parse()
context_start = full.rfind(' ', template_start);
if (context_start == llvm::StringRef::npos)
context_start = 0;
+ else
+ ++context_start;
context_end = full.rfind(':', template_start);
if (context_end == llvm::StringRef::npos || context_end < context_start)
@@ -240,7 +242,7 @@ CPlusPlusLanguage::MethodName::Parse()
else
{
if (context_start < context_end)
- m_context = full.substr(context_start, context_end - 1);
+ m_context = full.substr(context_start, context_end - 1 - context_start);
const size_t basename_begin = context_end + 1;
m_basename = full.substr(basename_begin, basename_end - basename_begin);
}