aboutsummaryrefslogtreecommitdiff
path: root/tools/clang/blink_gc_plugin/tests/destructor_eagerly_finalized.cpp
blob: 07409cc3ab36b48cbc905e5a78a7c7013608e38f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "destructor_eagerly_finalized.h"

namespace blink {

HeapObjectEagerFinalized::~HeapObjectEagerFinalized()
{
    // Valid access to a non-eagerly finalized field
    m_obj->foo();
}

void HeapObjectEagerFinalized::trace(Visitor* visitor)
{
    visitor->trace(m_obj);
}

HeapObjectEagerFinalizedAlso::~HeapObjectEagerFinalizedAlso()
{
    // Valid access to a non-eagerly finalized field
    m_heapObject->foo();

    // Non-valid accesses to eagerly finalized fields.
    m_heapObjectFinalized->foo();
    m_heapVector[0]->foo();
}

void HeapObjectEagerFinalizedAlso::trace(Visitor* visitor)
{
    visitor->trace(m_heapObject);
    visitor->trace(m_heapObjectFinalized);
    visitor->trace(m_heapVector);
}

} // namespace blink