Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/include/llvm/DebugInfo/DWARF/DWARFAddressRange.h
Line
Count
Source
1
//===- DWARFAddressRange.h --------------------------------------*- C++ -*-===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
9
#ifndef LLVM_DEBUGINFO_DWARF_DWARFADDRESSRANGE_H
10
#define LLVM_DEBUGINFO_DWARF_DWARFADDRESSRANGE_H
11
12
#include "llvm/DebugInfo/DIContext.h"
13
#include <cstdint>
14
#include <tuple>
15
#include <vector>
16
17
namespace llvm {
18
19
class raw_ostream;
20
21
struct DWARFAddressRange {
22
  uint64_t LowPC;
23
  uint64_t HighPC;
24
  uint64_t SectionIndex;
25
26
  DWARFAddressRange() = default;
27
28
  /// Used for unit testing.
29
  DWARFAddressRange(uint64_t LowPC, uint64_t HighPC, uint64_t SectionIndex = 0)
30
890
      : LowPC(LowPC), HighPC(HighPC), SectionIndex(SectionIndex) {}
31
32
  /// Returns true if LowPC is smaller or equal to HighPC. This accounts for
33
  /// dead-stripped ranges.
34
137
  bool valid() const { return LowPC <= HighPC; }
35
36
  /// Returns true if [LowPC, HighPC) intersects with [RHS.LowPC, RHS.HighPC).
37
332
  bool intersects(const DWARFAddressRange &RHS) const {
38
332
    assert(valid() && RHS.valid());
39
332
    // Empty ranges can't intersect.
40
332
    if (LowPC == HighPC || 
RHS.LowPC == RHS.HighPC329
)
41
7
      return false;
42
325
    return LowPC < RHS.HighPC && 
RHS.LowPC < HighPC302
;
43
325
  }
44
45
  void dump(raw_ostream &OS, uint32_t AddressSize,
46
            DIDumpOptions DumpOpts = {}) const;
47
};
48
49
static inline bool operator<(const DWARFAddressRange &LHS,
50
472
                             const DWARFAddressRange &RHS) {
51
472
  return std::tie(LHS.LowPC, LHS.HighPC) < std::tie(RHS.LowPC, RHS.HighPC);
52
472
}
Unexecuted instantiation: ObjectFilePCHContainerOperations.cpp:llvm::operator<(llvm::DWARFAddressRange const&, llvm::DWARFAddressRange const&)
Unexecuted instantiation: DWARFAbbreviationDeclaration.cpp:llvm::operator<(llvm::DWARFAddressRange const&, llvm::DWARFAddressRange const&)
Unexecuted instantiation: DWARFAddressRange.cpp:llvm::operator<(llvm::DWARFAddressRange const&, llvm::DWARFAddressRange const&)
Unexecuted instantiation: DWARFCompileUnit.cpp:llvm::operator<(llvm::DWARFAddressRange const&, llvm::DWARFAddressRange const&)
Unexecuted instantiation: DWARFContext.cpp:llvm::operator<(llvm::DWARFAddressRange const&, llvm::DWARFAddressRange const&)
Unexecuted instantiation: DWARFDataExtractor.cpp:llvm::operator<(llvm::DWARFAddressRange const&, llvm::DWARFAddressRange const&)
Unexecuted instantiation: DWARFDebugAddr.cpp:llvm::operator<(llvm::DWARFAddressRange const&, llvm::DWARFAddressRange const&)
Unexecuted instantiation: DWARFDebugAranges.cpp:llvm::operator<(llvm::DWARFAddressRange const&, llvm::DWARFAddressRange const&)
Unexecuted instantiation: DWARFDebugInfoEntry.cpp:llvm::operator<(llvm::DWARFAddressRange const&, llvm::DWARFAddressRange const&)
Unexecuted instantiation: DWARFDebugLine.cpp:llvm::operator<(llvm::DWARFAddressRange const&, llvm::DWARFAddressRange const&)
Unexecuted instantiation: DWARFDebugLoc.cpp:llvm::operator<(llvm::DWARFAddressRange const&, llvm::DWARFAddressRange const&)
Unexecuted instantiation: DWARFDebugRangeList.cpp:llvm::operator<(llvm::DWARFAddressRange const&, llvm::DWARFAddressRange const&)
Unexecuted instantiation: DWARFDebugRnglists.cpp:llvm::operator<(llvm::DWARFAddressRange const&, llvm::DWARFAddressRange const&)
Unexecuted instantiation: DWARFDie.cpp:llvm::operator<(llvm::DWARFAddressRange const&, llvm::DWARFAddressRange const&)
Unexecuted instantiation: DWARFExpression.cpp:llvm::operator<(llvm::DWARFAddressRange const&, llvm::DWARFAddressRange const&)
Unexecuted instantiation: DWARFFormValue.cpp:llvm::operator<(llvm::DWARFAddressRange const&, llvm::DWARFAddressRange const&)
Unexecuted instantiation: DWARFTypeUnit.cpp:llvm::operator<(llvm::DWARFAddressRange const&, llvm::DWARFAddressRange const&)
Unexecuted instantiation: DWARFUnit.cpp:llvm::operator<(llvm::DWARFAddressRange const&, llvm::DWARFAddressRange const&)
DWARFVerifier.cpp:llvm::operator<(llvm::DWARFAddressRange const&, llvm::DWARFAddressRange const&)
Line
Count
Source
50
472
                             const DWARFAddressRange &RHS) {
51
472
  return std::tie(LHS.LowPC, LHS.HighPC) < std::tie(RHS.LowPC, RHS.HighPC);
52
472
}
53
54
raw_ostream &operator<<(raw_ostream &OS, const DWARFAddressRange &R);
55
56
/// DWARFAddressRangesVector - represents a set of absolute address ranges.
57
using DWARFAddressRangesVector = std::vector<DWARFAddressRange>;
58
59
} // end namespace llvm
60
61
#endif // LLVM_DEBUGINFO_DWARF_DWARFADDRESSRANGE_H