summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2016-09-13 10:39:12 +0000
committerPavel Labath <labath@google.com>2016-09-13 10:39:12 +0000
commitdf91b2fea816f7fcc7cd5f609e6b44964dcabe2b (patch)
tree1324cee38dadb1f4b5125426506cf55d1c203e29
parentb4829e4e0cf9ef9facf9396d094e0e75b1de381f (diff)
downloadbcm5719-llvm-df91b2fea816f7fcc7cd5f609e6b44964dcabe2b.tar.gz
bcm5719-llvm-df91b2fea816f7fcc7cd5f609e6b44964dcabe2b.zip
Remove MIUtilParse (no longer used)
Summary: follow-up to https://reviews.llvm.org/D23882 Reviewers: dawn, krytarowski, labath, ki.stfu Subscribers: beanz, mgorny, labath, ki.stfu, lldb-commits Differential Revision: https://reviews.llvm.org/D23883 Author: Michał Górny <mgorny@gentoo.org> llvm-svn: 281317
-rw-r--r--lldb/tools/lldb-mi/CMakeLists.txt1
-rw-r--r--lldb/tools/lldb-mi/MIUtilParse.cpp74
-rw-r--r--lldb/tools/lldb-mi/MIUtilParse.h77
3 files changed, 0 insertions, 152 deletions
diff --git a/lldb/tools/lldb-mi/CMakeLists.txt b/lldb/tools/lldb-mi/CMakeLists.txt
index 79f657a3ddd..01ad483e4a4 100644
--- a/lldb/tools/lldb-mi/CMakeLists.txt
+++ b/lldb/tools/lldb-mi/CMakeLists.txt
@@ -65,7 +65,6 @@ set(LLDB_MI_SOURCES
MIDriverBase.cpp
MIDriverMain.cpp
MIDriverMgr.cpp
- MIUtilParse.cpp
MIUtilDateTimeStd.cpp
MIUtilDebug.cpp
MIUtilFileStd.cpp
diff --git a/lldb/tools/lldb-mi/MIUtilParse.cpp b/lldb/tools/lldb-mi/MIUtilParse.cpp
deleted file mode 100644
index 7b039e32131..00000000000
--- a/lldb/tools/lldb-mi/MIUtilParse.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-//===-- MIUtilParse.cpp ----------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// Third party headers:
-#include <memory>
-
-// In-house headers:
-#include "MIUtilParse.h"
-
-//++
-//------------------------------------------------------------------------------------
-// Details: CRegexParser constructor.
-// Type: Method.
-// Args: regexStr - Pointer to the regular expression to compile.
-// Return: None.
-// Throws: None.
-//--
-MIUtilParse::CRegexParser::CRegexParser(const char *regexStr)
- : m_isValid(llvm_regcomp(&m_emma, regexStr, REG_EXTENDED) == 0) {}
-
-//++
-//------------------------------------------------------------------------------------
-// Details: CRegexParser destructor.
-// Type: Method.
-// Args: None.
-// Return: None.
-// Throws: None.
-//--
-MIUtilParse::CRegexParser::~CRegexParser() {
- // Free up memory held within regex.
- if (m_isValid)
- llvm_regfree(&m_emma);
-}
-
-//++
-//------------------------------------------------------------------------------------
-// Details: CRegexParser regex executer.
-// 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.
-// Type: Method.
-// Args: input (R) - Pointer to UTF8 text data to be parsed.
-// match (RW) - Reference to Match class.
-// minMatches (R) - Minimum number of regex matches expected.
-// Return: bool - True = minimum matches were met,
-// false = minimum matches were not met or regex failed.
-// Throws: None.
-//--
-bool MIUtilParse::CRegexParser::Execute(const char *input, Match &match,
- size_t minMatches) {
- if (!m_isValid)
- return false;
-
- std::unique_ptr<llvm_regmatch_t[]> matches(
- new llvm_regmatch_t[match.m_maxMatches]); // Array of matches
-
- if (llvm_regexec(&m_emma, input, match.m_maxMatches, matches.get(), 0) != 0)
- return false;
-
- size_t i;
- for (i = 0; i < match.m_maxMatches && matches[i].rm_so >= 0; i++) {
- const int n = matches[i].rm_eo - matches[i].rm_so;
- match.m_matchStrs[i].assign(input + matches[i].rm_so, n);
- }
- return i >= minMatches;
-}
diff --git a/lldb/tools/lldb-mi/MIUtilParse.h b/lldb/tools/lldb-mi/MIUtilParse.h
deleted file mode 100644
index cb74f4708b4..00000000000
--- a/lldb/tools/lldb-mi/MIUtilParse.h
+++ /dev/null
@@ -1,77 +0,0 @@
-//===-- MIUtilParse.h ------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// 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 {
-
-//++
-//============================================================================
-// Details: MI common code utility class. Used to parse the output
-// returned from lldb commands using regex.
-//--
-class 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; }
-
- // 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;
-};
-}
OpenPOWER on IntegriCloud