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

Side by Side Diff: tools/clang/blink_gc_plugin/BlinkGCPluginConsumer.cpp

Issue 2902563002: blink_gc_plugin: disallow WeakMember<> fields in off-heap objects. (Closed)
Patch Set: add missing file from ps#3 Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "BlinkGCPluginConsumer.h" 5 #include "BlinkGCPluginConsumer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 9
10 #include "CheckDispatchVisitor.h" 10 #include "CheckDispatchVisitor.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 188
189 // Check polymorphic classes that are GC-derived or have a trace method. 189 // Check polymorphic classes that are GC-derived or have a trace method.
190 if (info->record()->hasDefinition() && info->record()->isPolymorphic()) { 190 if (info->record()->hasDefinition() && info->record()->isPolymorphic()) {
191 // TODO: Check classes that inherit a trace method. 191 // TODO: Check classes that inherit a trace method.
192 CXXMethodDecl* trace = info->GetTraceMethod(); 192 CXXMethodDecl* trace = info->GetTraceMethod();
193 if (trace || info->IsGCDerived()) 193 if (trace || info->IsGCDerived())
194 CheckPolymorphicClass(info, trace); 194 CheckPolymorphicClass(info, trace);
195 } 195 }
196 196
197 { 197 {
198 CheckFieldsVisitor visitor; 198 CheckFieldsVisitor visitor(options_);
199 if (visitor.ContainsInvalidFields(info)) 199 if (visitor.ContainsInvalidFields(info))
200 reporter_.ClassContainsInvalidFields(info, visitor.invalid_fields()); 200 reporter_.ClassContainsInvalidFields(info, visitor.invalid_fields());
201 } 201 }
202 202
203 if (info->IsGCDerived()) { 203 if (info->IsGCDerived()) {
204 // It is illegal for a class to be both stack allocated and garbage 204 // It is illegal for a class to be both stack allocated and garbage
205 // collected. 205 // collected.
206 if (info->IsStackAllocated()) { 206 if (info->IsStackAllocated()) {
207 for (auto& base : info->GetBases()) { 207 for (auto& base : info->GetBases()) {
208 RecordInfo* base_info = base.second.info(); 208 RecordInfo* base_info = base.second.info();
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 SourceLocation spelling_location = source_manager.getSpellingLoc(loc); 714 SourceLocation spelling_location = source_manager.getSpellingLoc(loc);
715 PresumedLoc ploc = source_manager.getPresumedLoc(spelling_location); 715 PresumedLoc ploc = source_manager.getPresumedLoc(spelling_location);
716 if (ploc.isInvalid()) { 716 if (ploc.isInvalid()) {
717 // If we're in an invalid location, we're looking at things that aren't 717 // If we're in an invalid location, we're looking at things that aren't
718 // actually stated in the source. 718 // actually stated in the source.
719 return false; 719 return false;
720 } 720 }
721 *filename = ploc.getFilename(); 721 *filename = ploc.getFilename();
722 return true; 722 return true;
723 } 723 }
OLDNEW
« no previous file with comments | « tools/clang/blink_gc_plugin/BlinkGCPlugin.cpp ('k') | tools/clang/blink_gc_plugin/BlinkGCPluginOptions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698