Commit 0c2bbfd5 authored by Michael Lippautz's avatar Michael Lippautz Committed by V8 LUCI CQ

cppgc: Add CHECK for diagnosing Persistent issue

Bug: chromium:1253650
Change-Id: I289dae157408ab68d76fb168aadf7924c3a65c09
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3302798Reviewed-by: 's avatarAnton Bikineev <bikineev@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78102}
parent 01a6b6d9
......@@ -189,6 +189,9 @@ class BasicPersistent final : public PersistentBase,
// heterogeneous assignments between different Member and Persistent handles
// based on their actual types.
V8_CLANG_NO_SANITIZE("cfi-unrelated-cast") T* Get() const {
// TODO(chromium:1253650): Temporary CHECK to diagnose issues.
CPPGC_CHECK(IsValid() == !!GetNode());
// The const_cast below removes the constness from PersistentBase storage.
// The following static_cast re-adds any constness if specified through the
// user-visible template parameter T.
......@@ -196,6 +199,8 @@ class BasicPersistent final : public PersistentBase,
}
void Clear() {
// TODO(chromium:1253650): Temporary CHECK to diagnose issues.
CPPGC_CHECK(IsValid() == !!GetNode());
// Simplified version of `Assign()` to allow calling without a complete type
// `T`.
if (IsValid()) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment