forked from OSchip/llvm-project
[ORC] Allow construction of an ExecutorAddrRange from an addr and a size.
This commit is contained in:
parent
9911af4b91
commit
37f1b7a3f3
|
@ -135,6 +135,8 @@ struct ExecutorAddrRange {
|
|||
ExecutorAddrRange() = default;
|
||||
ExecutorAddrRange(ExecutorAddr Start, ExecutorAddr End)
|
||||
: Start(Start), End(End) {}
|
||||
ExecutorAddrRange(ExecutorAddr Start, ExecutorAddrDiff Size)
|
||||
: Start(Start), End(Start + Size) {}
|
||||
|
||||
bool empty() const { return Start == End; }
|
||||
ExecutorAddrDiff size() const { return End - Start; }
|
||||
|
|
|
@ -58,6 +58,7 @@ TEST(ExecutorAddrTest, AddrRanges) {
|
|||
// R4: ## -- Overlaps R1 end
|
||||
|
||||
EXPECT_EQ(R1, ExecutorAddrRange(A1, A2));
|
||||
EXPECT_EQ(R1, ExecutorAddrRange(A1, ExecutorAddrDiff(1)));
|
||||
EXPECT_NE(R1, R2);
|
||||
|
||||
EXPECT_TRUE(R1.contains(A1));
|
||||
|
|
Loading…
Reference in New Issue