[PATCH] D53975: Start adding the supporting code to perform out-of-process allocator enumeration.
Dan Liew via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 6 13:41:49 PST 2018
delcypher added inline comments.
================
Comment at: lib/sanitizer_common/sanitizer_allocator_secondary.h:290
+ auto t2 = ObjectView::MakeView(&chunks_[i]);
+ CHECK_EQ(static_cast<Header *>(t), static_cast<Header *>(t2));
+ if (ObjectView::IsLocal()) {
----------------
george.karpenkov wrote:
> Cast seems to be the wrong operator here, why not `*` ?
> Then we could write
>
> `CHECK_EQ(*t, *ObjectView::MakeView(&chunks_[i]))`
I'm basically just using `static_cast<Header*>()` to trigger to the conversion operator to `ObjectTy&`.
I could also provide a `operator*()`. I'm just not convinced it's clearer.
We could also provide `operator==`. So that the check reads as `CHECK_EQ(t, ObjectView::MakeView(&chunks_[i]))`.
The problem there though is that template instantiation will fail if the `ObjectTy` in `LocalObjectView` doesn't have an `==` operator. We could use `std::enable_if` to conditionally declare the operator only if `ObjectTy` has an `==` operator. The trouble with that is because C++ doesn't have concepts yet, actually writing this would be extremely messy.
Repository:
rCRT Compiler Runtime
https://reviews.llvm.org/D53975
More information about the llvm-commits
mailing list