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

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

Issue 2685583002: blink_gc_plugin: warn of unused trace methods to stack allocated classes. (Closed)
Patch Set: rebased upto r449038 Created 3 years, 10 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 } 174 }
175 175
176 CheckClass(info); 176 CheckClass(info);
177 } 177 }
178 178
179 void BlinkGCPluginConsumer::CheckClass(RecordInfo* info) { 179 void BlinkGCPluginConsumer::CheckClass(RecordInfo* info) {
180 if (!info) 180 if (!info)
181 return; 181 return;
182 182
183 if (CXXMethodDecl* trace = info->GetTraceMethod()) { 183 if (CXXMethodDecl* trace = info->GetTraceMethod()) {
184 if (options_.warn_stack_allocated_trace_method && info->IsStackAllocated())
185 reporter_.TraceMethodForStackAllocatedClass(info, trace);
184 if (trace->isPure()) 186 if (trace->isPure())
185 reporter_.ClassDeclaresPureVirtualTrace(info, trace); 187 reporter_.ClassDeclaresPureVirtualTrace(info, trace);
186 } else if (info->RequiresTraceMethod()) { 188 } else if (info->RequiresTraceMethod()) {
187 reporter_.ClassRequiresTraceMethod(info); 189 reporter_.ClassRequiresTraceMethod(info);
188 } 190 }
189 191
190 // Check polymorphic classes that are GC-derived or have a trace method. 192 // Check polymorphic classes that are GC-derived or have a trace method.
191 if (info->record()->hasDefinition() && info->record()->isPolymorphic()) { 193 if (info->record()->hasDefinition() && info->record()->isPolymorphic()) {
192 // TODO: Check classes that inherit a trace method. 194 // TODO: Check classes that inherit a trace method.
193 CXXMethodDecl* trace = info->GetTraceMethod(); 195 CXXMethodDecl* trace = info->GetTraceMethod();
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 SourceLocation spelling_location = source_manager.getSpellingLoc(loc); 717 SourceLocation spelling_location = source_manager.getSpellingLoc(loc);
716 PresumedLoc ploc = source_manager.getPresumedLoc(spelling_location); 718 PresumedLoc ploc = source_manager.getPresumedLoc(spelling_location);
717 if (ploc.isInvalid()) { 719 if (ploc.isInvalid()) {
718 // If we're in an invalid location, we're looking at things that aren't 720 // If we're in an invalid location, we're looking at things that aren't
719 // actually stated in the source. 721 // actually stated in the source.
720 return false; 722 return false;
721 } 723 }
722 *filename = ploc.getFilename(); 724 *filename = ploc.getFilename();
723 return true; 725 return true;
724 } 726 }
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