Skip to content

Commit 37f1b7a

Browse files
committed
[ORC] Allow construction of an ExecutorAddrRange from an addr and a size.
1 parent 9911af4 commit 37f1b7a

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

llvm/include/llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ struct ExecutorAddrRange {
135135
ExecutorAddrRange() = default;
136136
ExecutorAddrRange(ExecutorAddr Start, ExecutorAddr End)
137137
: Start(Start), End(End) {}
138+
ExecutorAddrRange(ExecutorAddr Start, ExecutorAddrDiff Size)
139+
: Start(Start), End(Start + Size) {}
138140

139141
bool empty() const { return Start == End; }
140142
ExecutorAddrDiff size() const { return End - Start; }

llvm/unittests/ExecutionEngine/Orc/ExecutorAddressTest.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ TEST(ExecutorAddrTest, AddrRanges) {
5858
// R4: ## -- Overlaps R1 end
5959

6060
EXPECT_EQ(R1, ExecutorAddrRange(A1, A2));
61+
EXPECT_EQ(R1, ExecutorAddrRange(A1, ExecutorAddrDiff(1)));
6162
EXPECT_NE(R1, R2);
6263

6364
EXPECT_TRUE(R1.contains(A1));

0 commit comments

Comments
 (0)