New issue
Advanced search Search tips

Issue 643768 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Sep 2016
Cc:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug

Blocking:
issue 578344



Sign in to add a comment

rewrite_to_chrome_style: error: [blink-gc] Class 'RTCConfiguration' has untraced fields that require tracing.

Project Member Reported by lukasza@chromium.org, Sep 2 2016

Issue description

So, the rewrite by the tool looks more or less like this:

class PLATFORM_EXPORT RTCConfiguration final : public GarbageCollectedFinalized<RTCConfiguration> {
 public:
... 
-    DEFINE_INLINE_TRACE() { visitor->trace(m_servers); }
+    DEFINE_INLINE_TRACE() { visitor->trace(servers_); }
 
 private:
...
-    HeapVector<Member<RTCIceServer>> m_servers;
...
+    HeapVector<Member<RTCIceServer>> servers_;
...
 };

Given above, I was rather surprised when I saw the following build error:

In file included from ../../third_party/WebKit/Source/platform/exported/WebRTCConfiguration.cpp:33:
../../third_party/WebKit/Source/platform/peerconnection/RTCConfiguration.h:106:5: error: [blink-gc] Class 'RTCConfiguration' has untraced fields that require tracing.
    DEFINE_INLINE_TRACE() { visitor->trace(servers_); }
    ^
../../third_party/WebKit/Source/platform/heap/Visitor.h:112:31: note: expanded from macro 'DEFINE_INLINE_TRACE'
#define DEFINE_INLINE_TRACE() DEFINE_INLINE_TRACE_IMPL(EMPTY_MACRO_ARGUMENT)
                              ^
../../third_party/WebKit/Source/platform/heap/Visitor.h:83:18: note: expanded from macro 'DEFINE_INLINE_TRACE_IMPL'
    maybevirtual void trace(Visitor* visitor) { TraceImpl(visitor); }                    \
                 ^
../../third_party/WebKit/Source/platform/peerconnection/RTCConfiguration.h:114:5: note: [blink-gc] Untraced field 'servers_' declared here:
    HeapVector<Member<RTCIceServer>> servers_;
    ^
1 error generated.
 

 
I am not sure who I can CC for the clang-plugin (I assume) that produces the error above.

Also - in addition to any fix ideas, it would be great if I could somehow work around this bug to uncover other build errors that are masked by errors of this nature.
BTW: there is more than one occurrence of this error after the rename-by-tool.  Another one occurs in here:

../../third_party/WebKit/Source/platform/Widget.cpp:44:1: error: [blink-gc] Class 'Widget' has untraced fields that require tracing.
DEFINE_TRACE(Widget)
^
../../third_party/WebKit/Source/platform/heap/Visitor.h:77:5: note: expanded from macro 'DEFINE_TRACE'
    void T::trace(Visitor* visitor) { TraceImpl(visitor); }                    \
    ^
../../third_party/WebKit/Source/platform/Widget.h:126:5: note: [blink-gc] Untraced field 'parent_' declared here:
    Member<Widget> parent_;
    ^

Despite the fact that |parent_| *is* getting traced AFAICT:

DEFINE_TRACE(Widget)
{
    visitor->trace(parent_);
}
Cc: haraken@chromium.org
> I am not sure who I can CC for the clang-plugin (I assume) that produces the error above.

Maybe haraken can help.
Hmmm... maybe this is related to  issue 584538  - I'd have to double-check.
I see that the renaming tool made the following change (and maybe renaming traceImpl -> TraceImpl is wrong / should be avoided?):

 #define DEFINE_INLINE_TRACE_IMPL(maybevirtual)                                           \
-    maybevirtual void trace(Visitor* visitor) { traceImpl(visitor); }                    \
-    maybevirtual void trace(InlinedGlobalMarkingVisitor visitor) { traceImpl(visitor); } \
+    maybevirtual void trace(Visitor* visitor) { TraceImpl(visitor); }                    \
+    maybevirtual void trace(InlinedGlobalMarkingVisitor visitor) { TraceImpl(visitor); } \
     template <typename VisitorDispatcher>                                                \
-    inline void traceImpl(VisitorDispatcher visitor)
+    inline void TraceImpl(VisitorDispatcher visitor)

FWIW, "trace" is already on the list of blacklisted methods (and maybe we just need to add "traceImpl" to the list):

tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp:174:

bool IsBlacklistedMethod(const std::string& name,
                         const clang::CXXMethodDecl* decl) {
  if (decl && decl->isStatic())
    return false;
...
  // These methods should never be renamed.
  static const char* kBlacklistMethods[] = {"trace", "lock", "unlock",
                                            "try_lock"};
  for (const auto& b : kBlacklistMethods) {
    if (name == b)
      return true;
  }
...
I forget why we thot trace() was good there, maybe its for oilpan maybe it's for stl.. https://codereview.chromium.org/1647763002/diff/40001/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp#newcode67

but anyway.. blacklist away to get this to go. Macros are a huge pain for this tool and we gotta work around them. 

We can follow up with a manual rename on traceImpl, or do it ahead of time. Let's just make sure we have a bug (this one's fine) to make that happen.
Project Member

Comment 8 by bugdroid1@chromium.org, Sep 6 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/71ba89445384ec09c78d0dfce3d92b90da6cc57e

commit 71ba89445384ec09c78d0dfce3d92b90da6cc57e
Author: lukasza <lukasza@chromium.org>
Date: Tue Sep 06 23:04:34 2016

Blacklist renaming of traceImpl method for compatibility with Oilpan plugin.

BUG= 643768 

Review-Url: https://codereview.chromium.org/2314853002
Cr-Commit-Position: refs/heads/master@{#416750}

[modify] https://crrev.com/71ba89445384ec09c78d0dfce3d92b90da6cc57e/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp

Status: Fixed (was: Untriaged)
Owner: lukasza@chromium.org

Sign in to add a comment