[PATCH] D44772: [DWARF] Simplify DWARFAddressRange::contains
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 27 12:07:57 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL328655: [DWARF] Simplify DWARFAddressRange::contains (authored by MaskRay, committed by ).
Repository:
rL LLVM
https://reviews.llvm.org/D44772
Files:
llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFAddressRange.h
Index: llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFAddressRange.h
===================================================================
--- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFAddressRange.h
+++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFAddressRange.h
@@ -36,17 +36,17 @@
/// Returns true if [LowPC, HighPC) intersects with [RHS.LowPC, RHS.HighPC).
bool intersects(const DWARFAddressRange &RHS) const {
+ assert(valid() && RHS.valid());
// Empty ranges can't intersect.
if (LowPC == HighPC || RHS.LowPC == RHS.HighPC)
return false;
- return (LowPC < RHS.HighPC) && (HighPC > RHS.LowPC);
+ return LowPC < RHS.HighPC && RHS.LowPC < HighPC;
}
/// Returns true if [LowPC, HighPC) fully contains [RHS.LowPC, RHS.HighPC).
bool contains(const DWARFAddressRange &RHS) const {
- if (LowPC <= RHS.LowPC && RHS.LowPC <= HighPC)
- return LowPC <= RHS.HighPC && RHS.HighPC <= HighPC;
- return false;
+ assert(valid() && RHS.valid());
+ return LowPC <= RHS.LowPC && RHS.HighPC <= HighPC;
}
void dump(raw_ostream &OS, uint32_t AddressSize,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44772.139971.patch
Type: text/x-patch
Size: 1106 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180327/5b9fe9c6/attachment.bin>
More information about the llvm-commits
mailing list