Skip to content

Commit

Permalink
Move RangeMap.h into Utility
Browse files Browse the repository at this point in the history
Summary:
This file implements some general purpose data structures, and so it
belongs to the Utility module.

Reviewers: zturner, jingham, JDevlieghere, clayborg, espindola

Subscribers: emaste, mgorny, javed.absar, arichardson, MaskRay, lldb-commits

Differential Revision: https://reviews.llvm.org/D58970

llvm-svn: 355509
  • Loading branch information
labath committed Mar 6, 2019
1 parent 89e5347 commit b809331
Show file tree
Hide file tree
Showing 24 changed files with 44 additions and 62 deletions.
3 changes: 1 addition & 2 deletions lldb/include/lldb/Core/dwarf.h
Expand Up @@ -9,13 +9,12 @@
#ifndef DebugBase_dwarf_h_
#define DebugBase_dwarf_h_

#include "lldb/Utility/RangeMap.h"
#include <stdint.h>

// Get the DWARF constant definitions from llvm
#include "llvm/BinaryFormat/Dwarf.h"

#include "lldb/Core/RangeMap.h"

// and stuff them in our default namespace
using namespace llvm::dwarf;

Expand Down
5 changes: 2 additions & 3 deletions lldb/include/lldb/Symbol/ArmUnwindInfo.h
Expand Up @@ -9,12 +9,11 @@
#ifndef liblldb_ArmUnwindInfo_h_
#define liblldb_ArmUnwindInfo_h_

#include <vector>

#include "lldb/Core/RangeMap.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Utility/DataExtractor.h"
#include "lldb/Utility/RangeMap.h"
#include "lldb/lldb-private.h"
#include <vector>

/*
* Unwind information reader and parser for the ARM exception handling ABI
Expand Down
5 changes: 2 additions & 3 deletions lldb/include/lldb/Symbol/Block.h
Expand Up @@ -9,17 +9,16 @@
#ifndef liblldb_Block_h_
#define liblldb_Block_h_

#include <vector>

#include "lldb/Core/AddressRange.h"
#include "lldb/Core/RangeMap.h"
#include "lldb/Symbol/CompilerType.h"
#include "lldb/Symbol/LineEntry.h"
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Symbol/SymbolContextScope.h"
#include "lldb/Utility/RangeMap.h"
#include "lldb/Utility/Stream.h"
#include "lldb/Utility/UserID.h"
#include "lldb/lldb-private.h"
#include <vector>

namespace lldb_private {

Expand Down
7 changes: 3 additions & 4 deletions lldb/include/lldb/Symbol/CompactUnwindInfo.h
Expand Up @@ -9,14 +9,13 @@
#ifndef liblldb_CompactUnwindInfo_h_
#define liblldb_CompactUnwindInfo_h_

#include <mutex>
#include <vector>

#include "lldb/Core/RangeMap.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/UnwindPlan.h"
#include "lldb/Utility/DataExtractor.h"
#include "lldb/Utility/RangeMap.h"
#include "lldb/lldb-private.h"
#include <mutex>
#include <vector>

namespace lldb_private {

Expand Down
5 changes: 2 additions & 3 deletions lldb/include/lldb/Symbol/DWARFCallFrameInfo.h
Expand Up @@ -13,12 +13,11 @@
#include <mutex>

#include "lldb/Core/AddressRange.h"
#include "lldb/Utility/Flags.h"

#include "lldb/Core/RangeMap.h"
#include "lldb/Core/dwarf.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/UnwindPlan.h"
#include "lldb/Utility/Flags.h"
#include "lldb/Utility/RangeMap.h"
#include "lldb/Utility/VMRange.h"
#include "lldb/lldb-private.h"

Expand Down
5 changes: 2 additions & 3 deletions lldb/include/lldb/Symbol/LineTable.h
Expand Up @@ -9,13 +9,12 @@
#ifndef liblldb_LineTable_h_
#define liblldb_LineTable_h_

#include <vector>

#include "lldb/Core/ModuleChild.h"
#include "lldb/Core/RangeMap.h"
#include "lldb/Core/Section.h"
#include "lldb/Symbol/LineEntry.h"
#include "lldb/Utility/RangeMap.h"
#include "lldb/lldb-private.h"
#include <vector>

namespace lldb_private {

Expand Down
7 changes: 3 additions & 4 deletions lldb/include/lldb/Symbol/Symtab.h
Expand Up @@ -9,13 +9,12 @@
#ifndef liblldb_Symtab_h_
#define liblldb_Symtab_h_

#include <mutex>
#include <vector>

#include "lldb/Core/RangeMap.h"
#include "lldb/Core/UniqueCStringMap.h"
#include "lldb/Symbol/Symbol.h"
#include "lldb/Utility/RangeMap.h"
#include "lldb/lldb-private.h"
#include <mutex>
#include <vector>

namespace lldb_private {

Expand Down
7 changes: 3 additions & 4 deletions lldb/include/lldb/Symbol/Variable.h
Expand Up @@ -9,17 +9,16 @@
#ifndef liblldb_Variable_h_
#define liblldb_Variable_h_

#include <memory>
#include <vector>

#include "lldb/Core/Mangled.h"
#include "lldb/Core/RangeMap.h"
#include "lldb/Expression/DWARFExpression.h"
#include "lldb/Symbol/Declaration.h"
#include "lldb/Utility/CompletionRequest.h"
#include "lldb/Utility/RangeMap.h"
#include "lldb/Utility/UserID.h"
#include "lldb/lldb-enumerations.h"
#include "lldb/lldb-private.h"
#include <memory>
#include <vector>

namespace lldb_private {

Expand Down
6 changes: 2 additions & 4 deletions lldb/include/lldb/Target/Memory.h
Expand Up @@ -9,14 +9,12 @@
#ifndef liblldb_Memory_h_
#define liblldb_Memory_h_

#include "lldb/Utility/RangeMap.h"
#include "lldb/lldb-private.h"
#include <map>
#include <mutex>
#include <vector>


#include "lldb/Core/RangeMap.h"
#include "lldb/lldb-private.h"

namespace lldb_private {
//----------------------------------------------------------------------
// A class to track memory that was read from a live process between
Expand Down
4 changes: 2 additions & 2 deletions lldb/include/lldb/Target/MemoryRegionInfo.h
Expand Up @@ -10,9 +10,9 @@
#ifndef lldb_MemoryRegionInfo_h
#define lldb_MemoryRegionInfo_h

#include "lldb/Core/RangeMap.h"
#include "llvm/Support/FormatProviders.h"
#include "lldb/Utility/ConstString.h"
#include "lldb/Utility/RangeMap.h"
#include "llvm/Support/FormatProviders.h"

namespace lldb_private {
class MemoryRegionInfo {
Expand Down
Expand Up @@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//

#ifndef liblldb_RangeMap_h_
#define liblldb_RangeMap_h_
#ifndef LLDB_UTILITY_RANGEMAP_H
#define LLDB_UTILITY_RANGEMAP_H

#include <algorithm>
#include <vector>
Expand Down Expand Up @@ -53,10 +53,8 @@ template <typename B, typename S> struct Range {

void Slide(BaseType slide) { base += slide; }

bool Union(const Range &rhs)
{
if (DoesAdjoinOrIntersect(rhs))
{
bool Union(const Range &rhs) {
if (DoesAdjoinOrIntersect(rhs)) {
auto new_end = std::max<BaseType>(GetRangeEnd(), rhs.GetRangeEnd());
base = std::min<BaseType>(base, rhs.base);
size = new_end - base;
Expand Down Expand Up @@ -569,7 +567,6 @@ template <typename B, typename S> class RangeVector {
}

protected:

void CombinePrevAndNext(typename Collection::iterator pos) {
// Check if the prev or next entries in case they need to be unioned with
// the entry pointed to by "pos".
Expand All @@ -579,7 +576,7 @@ template <typename B, typename S> class RangeVector {
m_entries.erase(pos);
pos = prev;
}

auto end = m_entries.end();
if (pos != end) {
auto next = pos + 1;
Expand Down Expand Up @@ -947,4 +944,4 @@ template <typename B, typename T, unsigned N> class AddressDataArray {

} // namespace lldb_private

#endif // liblldb_RangeMap_h_
#endif // LLDB_UTILITY_RANGEMAP_H
2 changes: 1 addition & 1 deletion lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
Expand Up @@ -16,7 +16,6 @@
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/RangeMap.h"
#include "lldb/Core/Section.h"
#include "lldb/Host/FileSystem.h"
#include "lldb/Symbol/DWARFCallFrameInfo.h"
Expand All @@ -26,6 +25,7 @@
#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/RangeMap.h"
#include "lldb/Utility/Status.h"
#include "lldb/Utility/Stream.h"
#include "lldb/Utility/Timer.h"
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
Expand Up @@ -14,7 +14,6 @@
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/RangeMap.h"
#include "lldb/Core/Section.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Host/Host.h"
Expand All @@ -28,6 +27,7 @@
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/RangeMap.h"
#include "lldb/Utility/StreamString.h"
#include "lldb/Utility/Timer.h"
#include "lldb/Utility/UUID.h"
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
Expand Up @@ -17,7 +17,6 @@
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/RangeMap.h"
#include "lldb/Core/Section.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Host/Host.h"
Expand All @@ -35,6 +34,7 @@
#include "lldb/Utility/DataBuffer.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/RangeMap.h"
#include "lldb/Utility/RegisterValue.h"
#include "lldb/Utility/Status.h"
#include "lldb/Utility/StreamString.h"
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
Expand Up @@ -11,10 +11,10 @@

#include "lldb/Core/Address.h"
#include "lldb/Core/FileSpecList.h"
#include "lldb/Core/RangeMap.h"
#include "lldb/Host/SafeMachO.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/RangeMap.h"
#include "lldb/Utility/UUID.h"

//----------------------------------------------------------------------
Expand Down
3 changes: 1 addition & 2 deletions lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.h
Expand Up @@ -10,10 +10,9 @@
#define SymbolFileDWARF_DWARFDebugAranges_h_

#include "DWARFDebugArangeSet.h"
#include "lldb/Utility/RangeMap.h"
#include <list>

#include "lldb/Core/RangeMap.h"

class SymbolFileDWARF;

class DWARFDebugAranges {
Expand Down
5 changes: 2 additions & 3 deletions lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
Expand Up @@ -19,16 +19,15 @@
#include "llvm/ADT/DenseMap.h"
#include "llvm/Support/Threading.h"

#include "lldb/Utility/Flags.h"

#include "lldb/Core/RangeMap.h"
#include "lldb/Core/UniqueCStringMap.h"
#include "lldb/Core/dwarf.h"
#include "lldb/Expression/DWARFExpression.h"
#include "lldb/Symbol/DebugMacros.h"
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Symbol/SymbolFile.h"
#include "lldb/Utility/ConstString.h"
#include "lldb/Utility/Flags.h"
#include "lldb/Utility/RangeMap.h"
#include "lldb/lldb-private.h"

#include "DWARFDataExtractor.h"
Expand Down
Expand Up @@ -12,9 +12,9 @@
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleList.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/RangeMap.h"
#include "lldb/Core/Section.h"
#include "lldb/Host/FileSystem.h"
#include "lldb/Utility/RangeMap.h"
#include "lldb/Utility/RegularExpression.h"
#include "lldb/Utility/Timer.h"

Expand Down
Expand Up @@ -9,14 +9,13 @@
#ifndef SymbolFileDWARF_SymbolFileDWARFDebugMap_h_
#define SymbolFileDWARF_SymbolFileDWARFDebugMap_h_

#include "lldb/Symbol/SymbolFile.h"
#include "lldb/Utility/RangeMap.h"
#include "llvm/Support/Chrono.h"
#include <bitset>
#include <map>
#include <vector>

#include "lldb/Core/RangeMap.h"
#include "lldb/Symbol/SymbolFile.h"
#include "llvm/Support/Chrono.h"

#include "UniqueDWARFASTType.h"

class SymbolFileDWARF;
Expand Down
3 changes: 1 addition & 2 deletions lldb/source/Target/Memory.cpp
Expand Up @@ -7,11 +7,10 @@
//===----------------------------------------------------------------------===//

#include "lldb/Target/Memory.h"

#include "lldb/Core/RangeMap.h"
#include "lldb/Target/Process.h"
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/RangeMap.h"
#include "lldb/Utility/State.h"

#include <cinttypes>
Expand Down
2 changes: 0 additions & 2 deletions lldb/unittests/Core/CMakeLists.txt
@@ -1,7 +1,5 @@
add_lldb_unittest(LLDBCoreTests
MangledTest.cpp
RangeMapTest.cpp
RangeTest.cpp
RichManglingContextTest.cpp
StreamCallbackTest.cpp

Expand Down
2 changes: 2 additions & 0 deletions lldb/unittests/Utility/CMakeLists.txt
Expand Up @@ -19,6 +19,8 @@ add_lldb_unittest(UtilityTests
NameMatchesTest.cpp
PredicateTest.cpp
ProcessInfoTest.cpp
RangeMapTest.cpp
RangeTest.cpp
RegisterValueTest.cpp
ReproducerTest.cpp
ReproducerInstrumentationTest.cpp
Expand Down
Expand Up @@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//

#include "lldb/Core/RangeMap.h"
#include "lldb/Utility/RangeMap.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"

Expand Down
Expand Up @@ -6,8 +6,7 @@
//
//===----------------------------------------------------------------------===//

#include "lldb/Core/RangeMap.h"

#include "lldb/Utility/RangeMap.h"
#include <cstdint>
#include <type_traits>

Expand Down

0 comments on commit b809331

Please sign in to comment.