[PATCH] D44772: [DWARF] Simplify DWARFAddressRange::contains
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 26 13:58:07 PDT 2018
MaskRay updated this revision to Diff 139847.
MaskRay added a comment.
Update only `contains`
Repository:
rL LLVM
https://reviews.llvm.org/D44772
Files:
include/llvm/DebugInfo/DWARF/DWARFAddressRange.h
Index: include/llvm/DebugInfo/DWARF/DWARFAddressRange.h
===================================================================
--- include/llvm/DebugInfo/DWARF/DWARFAddressRange.h
+++ include/llvm/DebugInfo/DWARF/DWARFAddressRange.h
@@ -39,14 +39,13 @@
// 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.139847.patch
Type: text/x-patch
Size: 897 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180326/f938a709/attachment.bin>
More information about the llvm-commits
mailing list