summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h
diff options
context:
space:
mode:
authorEugene Zemtsov <ezemtsov@google.com>2017-04-06 22:36:02 +0000
committerEugene Zemtsov <ezemtsov@google.com>2017-04-06 22:36:02 +0000
commita633ee6e4a02e7326ebca396eb88024c009eab0d (patch)
treef10afcbf1a7abb487b2690a83013e15cd9b005cc /lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h
parent6129887d21f068b7a965d394bc629ab374b31384 (diff)
downloadbcm5719-llvm-a633ee6e4a02e7326ebca396eb88024c009eab0d.tar.gz
bcm5719-llvm-a633ee6e4a02e7326ebca396eb88024c009eab0d.zip
New C++ function name parsing logic (Resubmit)
Current implementation of CPlusPlusLanguage::MethodName::Parse() doesn't get anywhere close to covering full extent of possible function declarations. It causes incorrect behavior in avoid-stepping and sometimes messes printing of thread backtrace. This change implements more methodical parsing logic based on clang lexer and simple recursive parser. Examples: void std::vector<Class, std::allocator<Class>>::_M_emplace_back_aux<Class const&>(Class const&) void (*&std::_Any_data::_M_access<void (*)()>())() Previous version of this change (D31451) was rolled back due to an issue with Objective-C selectors being incorrectly recognized as a C++ identifier. Differential Revision: https://reviews.llvm.org/D31451 llvm-svn: 299721
Diffstat (limited to 'lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h')
-rw-r--r--lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h19
1 files changed, 4 insertions, 15 deletions
diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h
index dbc1d59c8ba..056cced2808 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h
+++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h
@@ -29,20 +29,13 @@ class CPlusPlusLanguage : public Language {
public:
class MethodName {
public:
- enum Type {
- eTypeInvalid,
- eTypeUnknownMethod,
- eTypeClassMethod,
- eTypeInstanceMethod
- };
-
MethodName()
: m_full(), m_basename(), m_context(), m_arguments(), m_qualifiers(),
- m_type(eTypeInvalid), m_parsed(false), m_parse_error(false) {}
+ m_parsed(false), m_parse_error(false) {}
MethodName(const ConstString &s)
: m_full(s), m_basename(), m_context(), m_arguments(), m_qualifiers(),
- m_type(eTypeInvalid), m_parsed(false), m_parse_error(false) {}
+ m_parsed(false), m_parse_error(false) {}
void Clear();
@@ -51,13 +44,9 @@ public:
Parse();
if (m_parse_error)
return false;
- if (m_type == eTypeInvalid)
- return false;
return (bool)m_full;
}
- Type GetType() const { return m_type; }
-
const ConstString &GetFullName() const { return m_full; }
std::string GetScopeQualifiedName();
@@ -72,6 +61,7 @@ public:
protected:
void Parse();
+ bool TrySimplifiedParse();
ConstString m_full; // Full name:
// "lldb::SBTarget::GetBreakpointAtIndex(unsigned int)
@@ -80,7 +70,6 @@ public:
llvm::StringRef m_context; // Decl context: "lldb::SBTarget"
llvm::StringRef m_arguments; // Arguments: "(unsigned int)"
llvm::StringRef m_qualifiers; // Qualifiers: "const"
- Type m_type;
bool m_parsed;
bool m_parse_error;
};
@@ -121,7 +110,7 @@ public:
// If the name is a lone C identifier (e.g. C) or a qualified C identifier
// (e.g. A::B::C) it will return true,
// and identifier will be the identifier (C and C respectively) and the
- // context will be "" and "A::B::" respectively.
+ // context will be "" and "A::B" respectively.
// If the name fails the heuristic matching for a qualified or unqualified
// C/C++ identifier, then it will return false
// and identifier and context will be unchanged.
OpenPOWER on IntegriCloud