[Lldb-commits] [lldb] r350088 - Delete lldb_utility::Range

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Thu Dec 27 01:44:27 PST 2018


Author: labath
Date: Thu Dec 27 01:44:27 2018
New Revision: 350088

URL: http://llvm.org/viewvc/llvm-project?rev=350088&view=rev
Log:
Delete lldb_utility::Range

This class is unused, and there is already a lldb_private::Range
(defined in lldb/Core/RangeMap.h), which has similar functionality.

Removed:
    lldb/trunk/include/lldb/Utility/Range.h
    lldb/trunk/source/Utility/Range.cpp
Modified:
    lldb/trunk/include/lldb/Target/MemoryRegionInfo.h
    lldb/trunk/source/Utility/CMakeLists.txt

Modified: lldb/trunk/include/lldb/Target/MemoryRegionInfo.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/MemoryRegionInfo.h?rev=350088&r1=350087&r2=350088&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/MemoryRegionInfo.h (original)
+++ lldb/trunk/include/lldb/Target/MemoryRegionInfo.h Thu Dec 27 01:44:27 2018
@@ -14,7 +14,6 @@
 #include "lldb/Core/RangeMap.h"
 #include "llvm/Support/FormatProviders.h"
 #include "lldb/Utility/ConstString.h"
-#include "lldb/Utility/Range.h"
 
 namespace lldb_private {
 class MemoryRegionInfo {

Removed: lldb/trunk/include/lldb/Utility/Range.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/Range.h?rev=350087&view=auto
==============================================================================
--- lldb/trunk/include/lldb/Utility/Range.h (original)
+++ lldb/trunk/include/lldb/Utility/Range.h (removed)
@@ -1,60 +0,0 @@
-//===--------------------- Range.h ------------------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef utility_Range_h_
-#define utility_Range_h_
-
-#include <stdint.h>
-
-namespace lldb_utility {
-
-class Range {
-public:
-  typedef uint64_t ValueType;
-
-  static const ValueType OPEN_END = UINT64_MAX;
-
-  Range(const Range &rng);
-
-  Range(ValueType low = 0, ValueType high = OPEN_END);
-
-  Range &operator=(const Range &rhs);
-
-  ValueType GetLow() { return m_low; }
-
-  ValueType GetHigh() { return m_high; }
-
-  void SetLow(ValueType low) { m_low = low; }
-
-  void SetHigh(ValueType high) { m_high = high; }
-
-  void Flip();
-
-  void Intersection(const Range &other);
-
-  void Union(const Range &other);
-
-  typedef bool (*RangeCallback)(ValueType index);
-
-  void Iterate(RangeCallback callback);
-
-  ValueType GetSize();
-
-  bool IsEmpty();
-
-private:
-  void InitRange();
-
-  ValueType m_low;
-  ValueType m_high;
-};
-
-} // namespace lldb_private
-
-#endif // #ifndef utility_Range_h_

Modified: lldb/trunk/source/Utility/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/CMakeLists.txt?rev=350088&r1=350087&r2=350088&view=diff
==============================================================================
--- lldb/trunk/source/Utility/CMakeLists.txt (original)
+++ lldb/trunk/source/Utility/CMakeLists.txt Thu Dec 27 01:44:27 2018
@@ -63,7 +63,6 @@ add_lldb_library(lldbUtility
   Log.cpp
   Logging.cpp
   NameMatches.cpp
-  Range.cpp
   RegisterValue.cpp
   RegularExpression.cpp
   Reproducer.cpp

Removed: lldb/trunk/source/Utility/Range.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/Range.cpp?rev=350087&view=auto
==============================================================================
--- lldb/trunk/source/Utility/Range.cpp (original)
+++ lldb/trunk/source/Utility/Range.cpp (removed)
@@ -1,76 +0,0 @@
-//===--------------------- Range.cpp -----------------------------*- C++-*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "lldb/Utility/Range.h"
-
-#include <algorithm>
-#include <utility>
-
-using namespace lldb_utility;
-
-Range::Range(const Range &rng) : m_low(rng.m_low), m_high(rng.m_high) {
-  InitRange();
-}
-
-Range::Range(Range::ValueType low, Range::ValueType high)
-    : m_low(low), m_high(high) {
-  InitRange();
-}
-
-void Range::InitRange() {
-  if (m_low == OPEN_END) {
-    if (m_high == OPEN_END)
-      m_low = 0;
-    else {
-      // make an empty range
-      m_low = 1;
-      m_high = 0;
-    }
-  }
-}
-
-Range &Range::operator=(const Range &rhs) {
-  if (&rhs != this) {
-    this->m_low = rhs.m_low;
-    this->m_high = rhs.m_high;
-  }
-  return *this;
-}
-
-void Range::Flip() { std::swap(m_high, m_low); }
-
-void Range::Intersection(const Range &other) {
-  m_low = std::max(m_low, other.m_low);
-  m_high = std::min(m_high, other.m_high);
-}
-
-void Range::Union(const Range &other) {
-  m_low = std::min(m_low, other.m_low);
-  m_high = std::max(m_high, other.m_high);
-}
-
-void Range::Iterate(RangeCallback callback) {
-  ValueType counter = m_low;
-  while (counter <= m_high) {
-    bool should_continue = callback(counter);
-    if (!should_continue)
-      return;
-    counter++;
-  }
-}
-
-bool Range::IsEmpty() { return (m_low > m_high); }
-
-Range::ValueType Range::GetSize() {
-  if (m_high == OPEN_END)
-    return OPEN_END;
-  if (m_high >= m_low)
-    return m_high - m_low + 1;
-  return 0;
-}




More information about the lldb-commits mailing list