diff options
author | Kate Stone <katherine.stone@apple.com> | 2016-09-06 20:57:50 +0000 |
---|---|---|
committer | Kate Stone <katherine.stone@apple.com> | 2016-09-06 20:57:50 +0000 |
commit | b9c1b51e45b845debb76d8658edabca70ca56079 (patch) | |
tree | dfcb5a13ef2b014202340f47036da383eaee74aa /lldb/tools/lldb-mi/MIUtilParse.h | |
parent | d5aa73376966339caad04013510626ec2e42c760 (diff) | |
download | bcm5719-llvm-b9c1b51e45b845debb76d8658edabca70ca56079.tar.gz bcm5719-llvm-b9c1b51e45b845debb76d8658edabca70ca56079.zip |
*** This commit represents a complete reformatting of the LLDB source code
*** to conform to clang-format’s LLVM style. This kind of mass change has
*** two obvious implications:
Firstly, merging this particular commit into a downstream fork may be a huge
effort. Alternatively, it may be worth merging all changes up to this commit,
performing the same reformatting operation locally, and then discarding the
merge for this particular commit. The commands used to accomplish this
reformatting were as follows (with current working directory as the root of
the repository):
find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} +
find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ;
The version of clang-format used was 3.9.0, and autopep8 was 1.2.4.
Secondly, “blame” style tools will generally point to this commit instead of
a meaningful prior commit. There are alternatives available that will attempt
to look through this change and find the appropriate prior commit. YMMV.
llvm-svn: 280751
Diffstat (limited to 'lldb/tools/lldb-mi/MIUtilParse.h')
-rw-r--r-- | lldb/tools/lldb-mi/MIUtilParse.h | 126 |
1 files changed, 55 insertions, 71 deletions
diff --git a/lldb/tools/lldb-mi/MIUtilParse.h b/lldb/tools/lldb-mi/MIUtilParse.h index d3569586f81..cb74f4708b4 100644 --- a/lldb/tools/lldb-mi/MIUtilParse.h +++ b/lldb/tools/lldb-mi/MIUtilParse.h @@ -6,88 +6,72 @@ // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// - + #pragma once - + // Third party headers: #include "../lib/Support/regex_impl.h" // In-house headers: #include "MIUtilString.h" - -namespace MIUtilParse -{ - -//++ ============================================================================ + +namespace MIUtilParse { + +//++ +//============================================================================ // Details: MI common code utility class. Used to parse the output // returned from lldb commands using regex. //-- -class CRegexParser -{ +class CRegexParser { +public: + // Helper class for keeping track of regex matches. + class Match { + friend CRegexParser; + public: - // Helper class for keeping track of regex matches. - class Match - { - friend CRegexParser; - public: - /* ctor */ explicit Match(size_t nmatches) - : m_matchStrs(nmatches), m_maxMatches(nmatches) - { - } - size_t - GetMatchCount() const - { - return m_matchStrs.size(); - } - CMIUtilString - GetMatchAtIndex(size_t i) const - { - if (m_matchStrs.size() > i) - return m_matchStrs[i]; - return CMIUtilString(); - } - private: - CMIUtilString::VecString_t m_matchStrs; - const size_t m_maxMatches; - }; - - // Methods: - // Compile the regular expression. - /* ctor */ explicit CRegexParser(const char *regexStr); - - // Free the memory used by the regular expression. - /* dtor */ ~CRegexParser(); - - // No copies - CRegexParser(const CRegexParser&) = delete; - void operator=(CRegexParser&) = delete; - - // Return the match at the index. - int - GetMatchCount(const Match& match) const - { - if (m_isValid) - return match.GetMatchCount(); - return 0; - } - - bool - IsValid() const - { - return m_isValid; + /* ctor */ explicit Match(size_t nmatches) + : m_matchStrs(nmatches), m_maxMatches(nmatches) {} + size_t GetMatchCount() const { return m_matchStrs.size(); } + CMIUtilString GetMatchAtIndex(size_t i) const { + if (m_matchStrs.size() > i) + return m_matchStrs[i]; + return CMIUtilString(); } - - // Match the input against the regular expression. Return an error - // if the number of matches is less than minMatches. If the default - // minMatches value of 0 is passed, an error will be returned if - // the number of matches is less than the maxMatches value used to - // initialize Match. - bool - Execute(const char *input, Match& match, size_t minMatches = 0); - + private: - llvm_regex_t m_emma; - const bool m_isValid; -}; + CMIUtilString::VecString_t m_matchStrs; + const size_t m_maxMatches; + }; + // Methods: + // Compile the regular expression. + /* ctor */ explicit CRegexParser(const char *regexStr); + + // Free the memory used by the regular expression. + /* dtor */ ~CRegexParser(); + + // No copies + CRegexParser(const CRegexParser &) = delete; + void operator=(CRegexParser &) = delete; + + // Return the match at the index. + int GetMatchCount(const Match &match) const { + if (m_isValid) + return match.GetMatchCount(); + return 0; + } + + bool IsValid() const { return m_isValid; } + + // Match the input against the regular expression. Return an error + // if the number of matches is less than minMatches. If the default + // minMatches value of 0 is passed, an error will be returned if + // the number of matches is less than the maxMatches value used to + // initialize Match. + bool Execute(const char *input, Match &match, size_t minMatches = 0); + +private: + llvm_regex_t m_emma; + const bool m_isValid; +}; } |