[llvm] [Support] Add SpecificBumpPtrAllocator::identifyObject (PR #100475)
Alex Langford via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 25 10:06:02 PDT 2024
================
@@ -208,6 +208,19 @@ TEST(AllocatorTest, TestSlowerSlabGrowthDelay) {
EXPECT_EQ(SlabSize * GrowthDelay + SlabSize * 2, Alloc.getTotalMemory());
}
+TEST(AllocatorTest, TestIdentifyObject) {
+ BumpPtrAllocator Alloc;
+
+ uint64_t *a = (uint64_t *)Alloc.Allocate(sizeof(uint64_t), alignof(uint64_t));
+ std::optional<int64_t> maybe_a_belongs = Alloc.identifyObject(a);
+ EXPECT_TRUE(maybe_a_belongs.has_value());
+ EXPECT_TRUE(*maybe_a_belongs >= 0);
----------------
bulbazord wrote:
Oh, good idea. I'll update before landing! :)
https://github.com/llvm/llvm-project/pull/100475
More information about the llvm-commits
mailing list