Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Issue 2068983003: Revert of GC plugin: improve error reporting when tracing illegal fields. (Closed)

Created:
4 years, 6 months ago by Nico
Modified:
4 years, 6 months ago
Reviewers:
oilpan-reviews, haraken, sof
CC:
chromium-reviews
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Revert of GC plugin: improve error reporting when tracing illegal fields. (patchset #2 id:20001 of https://codereview.chromium.org/2060553002/ ) Reason for revert: New test fails: https://build.chromium.org/p/chromium.fyi/builders/ClangToTMac%20%28dbg%29/builds/5481/steps/gclient%20runhooks/logs/stdio Original issue's description: > GC plugin: improve error reporting when tracing illegal fields. > > Add detection of trace() calls over smart pointer types that either do not > wrap up references to heap objects, or are otherwise not meant to be traced > over. In particular, CrossThread(Weak)Persistent<T> fields are now detected > as being illegal to trace over. Also consider OwnPtr<T>, RefPtr<T> and > std::unique_ptr<T> as illegal to trace over & emit a more concise error > messages for these. > > R= > BUG=619149 > > Committed: https://crrev.com/3ba6089cd6a901b62ff5a0d8f08a2bd818edcbe8 > Cr-Commit-Position: refs/heads/master@{#399861} TBR=oilpan-reviews@chromium.org,sigbjornf@opera.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=619149 Committed: https://crrev.com/fd0eaf988b6b216d51e3eb9dde44b4df4f42c3a3 Cr-Commit-Position: refs/heads/master@{#399868}

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+32 lines, -406 lines) Patch
M tools/clang/blink_gc_plugin/BlinkGCPluginConsumer.cpp View 3 chunks +3 lines, -6 lines 0 comments Download
M tools/clang/blink_gc_plugin/CheckFieldsVisitor.h View 1 chunk +0 lines, -1 line 0 comments Download
M tools/clang/blink_gc_plugin/CheckFieldsVisitor.cpp View 3 chunks +0 lines, -5 lines 0 comments Download
M tools/clang/blink_gc_plugin/Config.h View 2 chunks +6 lines, -11 lines 0 comments Download
M tools/clang/blink_gc_plugin/DiagnosticsReporter.h View 4 chunks +2 lines, -6 lines 0 comments Download
M tools/clang/blink_gc_plugin/DiagnosticsReporter.cpp View 8 chunks +4 lines, -38 lines 0 comments Download
M tools/clang/blink_gc_plugin/Edge.h View 9 chunks +10 lines, -42 lines 0 comments Download
M tools/clang/blink_gc_plugin/Edge.cpp View 3 chunks +0 lines, -17 lines 0 comments Download
M tools/clang/blink_gc_plugin/RecordInfo.h View 4 chunks +0 lines, -11 lines 0 comments Download
M tools/clang/blink_gc_plugin/RecordInfo.cpp View 4 chunks +3 lines, -24 lines 0 comments Download
M tools/clang/blink_gc_plugin/TracingStatus.h View 2 chunks +2 lines, -23 lines 0 comments Download
D tools/clang/blink_gc_plugin/tests/fields_illegal_tracing.h View 1 chunk +0 lines, -56 lines 0 comments Download
D tools/clang/blink_gc_plugin/tests/fields_illegal_tracing.cpp View 1 chunk +0 lines, -23 lines 0 comments Download
D tools/clang/blink_gc_plugin/tests/fields_illegal_tracing.txt View 1 chunk +0 lines, -50 lines 0 comments Download
M tools/clang/blink_gc_plugin/tests/heap/stubs.h View 2 chunks +0 lines, -32 lines 0 comments Download
M tools/clang/blink_gc_plugin/tests/persistent_field_in_gc_managed_class.h View 1 chunk +0 lines, -1 line 0 comments Download
M tools/clang/blink_gc_plugin/tests/persistent_field_in_gc_managed_class.txt View 1 chunk +1 line, -7 lines 0 comments Download
D tools/clang/blink_gc_plugin/tests/persistent_no_trace.h View 1 chunk +0 lines, -22 lines 0 comments Download
D tools/clang/blink_gc_plugin/tests/persistent_no_trace.cpp View 1 chunk +0 lines, -14 lines 0 comments Download
D tools/clang/blink_gc_plugin/tests/persistent_no_trace.txt View 1 chunk +0 lines, -10 lines 0 comments Download
M tools/clang/blink_gc_plugin/tests/templated_class_with_local_class_requires_trace.txt View 1 chunk +1 line, -7 lines 0 comments Download

Messages

Total messages: 12 (2 generated)
Nico
Created Revert of GC plugin: improve error reporting when tracing illegal fields.
4 years, 6 months ago (2016-06-15 09:38:03 UTC) #2
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2068983003/1
4 years, 6 months ago (2016-06-15 09:38:16 UTC) #3
commit-bot: I haz the power
Committed patchset #1 (id:1)
4 years, 6 months ago (2016-06-15 09:39:12 UTC) #4
haraken
LGTM
4 years, 6 months ago (2016-06-15 09:39:12 UTC) #5
commit-bot: I haz the power
Patchset 1 (id:??) landed as https://crrev.com/fd0eaf988b6b216d51e3eb9dde44b4df4f42c3a3 Cr-Commit-Position: refs/heads/master@{#399868}
4 years, 6 months ago (2016-06-15 09:40:25 UTC) #7
sof
lgtm, sorry about the breakage - taking a look.
4 years, 6 months ago (2016-06-15 14:45:06 UTC) #8
sof
On 2016/06/15 14:45:06, sof wrote: > lgtm, sorry about the breakage - taking a look. ...
4 years, 6 months ago (2016-06-15 19:00:49 UTC) #9
Nico
On 2016/06/15 19:00:49, sof wrote: > On 2016/06/15 14:45:06, sof wrote: > > lgtm, sorry ...
4 years, 6 months ago (2016-06-15 21:09:23 UTC) #10
Nico
ps: great tool for going through clang code: http://llvm-cs.pcc.me.uk/?q=InEnclosingNamespaceSetOf
4 years, 6 months ago (2016-06-15 21:10:18 UTC) #11
sof
4 years, 6 months ago (2016-06-16 06:19:10 UTC) #12
Message was sent while issue was closed.
On 2016/06/15 21:09:23, Nico (traveling...slow) wrote:
> On 2016/06/15 19:00:49, sof wrote:
> > On 2016/06/15 14:45:06, sof wrote:
> > > lgtm, sorry about the breakage - taking a look.
> > 
> > Hmm, I can't reproduce this on a couple of boxes when building clang from
ToT.
> > i.e., the discrepancy here is that the bot is reporting no errors when using
> > std::unique_ptr<>s over GC types, but local builds are. As they should.
> > 
> > If I do the reasonable thing of removing the dummy definition of
> > std::unique_ptr<> from heap/stubs.h and include <memory> straight, local
> builds
> > behave like the bot and do not detect the std::unique_ptr<> cases. It looks
> like
> > the assumed singleton instance of a NamespaceDecl for "std" doesn't hold --
if
> I
> > add the assert
> > 
> >  assert(ns->getName() == "std" || ns == sema.getStdNamespace());
> > 
> > it fails. Hence I think we need to drop back to performing name comparisons
> when
> > resolving std::unique_ptr<> usages.
> 
> Ah right, I think you need something like
> 
>       bool IsInStd = false;
>       for (NamespaceDecl *ND = dyn_cast<NamespaceDecl>(R->getDeclContext());
>            ND && !IsInStd; ND = dyn_cast<NamespaceDecl>(ND->getParent())) {
>         if (SemaRef.getStdNamespace()->InEnclosingNamespaceSetOf(ND))
>           IsInStd = true;
>       }
> 
> (behind the scenes this calls DeclContext::Equals() which compares the
> getPrimaryContext() of both contexts instead of the contexts themselves). To
> repro in a test, `namespace std {} namespace std { /* unique_ptr in second
> namespace */}` will probably do the trick

Thanks, I couldn't find any form of 'deeper' equality checking over
NamespaceDecls when (randomly) looking. Adopted the above in
https://codereview.chromium.org/2060553002/

Powered by Google App Engine
This is Rietveld 408576698