Index: tools/clang/blink_gc_plugin/tests/traceimpl_omitted_trace.h |
diff --git a/tools/clang/blink_gc_plugin/tests/traceimpl_dependent_scope.h b/tools/clang/blink_gc_plugin/tests/traceimpl_omitted_trace.h |
similarity index 50% |
copy from tools/clang/blink_gc_plugin/tests/traceimpl_dependent_scope.h |
copy to tools/clang/blink_gc_plugin/tests/traceimpl_omitted_trace.h |
index 0d079f6f95925330f3303820337df05bc4e0d9c5..3c5e9559527d397ab01076a088ff1c234d6db89a 100644 |
--- a/tools/clang/blink_gc_plugin/tests/traceimpl_dependent_scope.h |
+++ b/tools/clang/blink_gc_plugin/tests/traceimpl_omitted_trace.h |
@@ -2,20 +2,14 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef TRACEIMPL_DEPENDENT_SCOPE_H_ |
-#define TRACEIMPL_DEPENDENT_SCOPE_H_ |
+#ifndef TRACEIMPL_OMITTED_TRACE_H_ |
+#define TRACEIMPL_OMITTED_TRACE_H_ |
#include "heap/stubs.h" |
namespace blink { |
-class X : public GarbageCollected<X> { |
- public: |
- virtual void trace(Visitor*) {} |
-}; |
- |
-template <typename T> |
-class Base : public GarbageCollected<Base<T> > { |
+class A : public GarbageCollected<A> { |
public: |
virtual void trace(Visitor* visitor) { traceImpl(visitor); } |
virtual void trace(InlinedGlobalMarkingVisitor visitor) { |
@@ -27,23 +21,11 @@ class Base : public GarbageCollected<Base<T> > { |
void traceImpl(VisitorDispatcher visitor) {} |
}; |
-template <typename T> |
-class Derived : public Base<T> { |
- public: |
- void trace(Visitor* visitor) override { traceImpl(visitor); } |
- void trace(InlinedGlobalMarkingVisitor visitor) override { |
- traceImpl(visitor); |
- } |
- |
- private: |
- template <typename VisitorDispatcher> |
- void traceImpl(VisitorDispatcher visitor) { |
- Base<T>::trace(visitor); |
- } |
+class B : public A { |
+ // trace() isn't necessary because we've got nothing to trace here. |
}; |
-template <typename T> |
-class DerivedMissingTrace : public Base<T> { |
+class C : public B { |
public: |
void trace(Visitor* visitor) override { traceImpl(visitor); } |
void trace(InlinedGlobalMarkingVisitor visitor) override { |
@@ -53,10 +35,13 @@ class DerivedMissingTrace : public Base<T> { |
private: |
template <typename VisitorDispatcher> |
void traceImpl(VisitorDispatcher visitor) { |
- // Missing Base<T>::trace(visitor). |
+ // B::trace() is actually A::trace(), and in certain cases we only get |
+ // limited information like "there is a function call that will be resolved |
+ // to A::trace()". We still want to mark B as traced. |
+ B::trace(visitor); |
} |
}; |
} |
-#endif // TRACEIMPL_DEPENDENT_SCOPE_H_ |
+#endif // TRACEIMPL_OMITTED_TRACE_H_ |