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

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

Issue 2323463002: [blink_gc_plugin] Complain about stack-allocated classes with GC bases, but not arbitrary non-stack… (Closed)
Patch Set: Created 4 years, 3 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "DiagnosticsReporter.h" 5 #include "DiagnosticsReporter.h"
6 6
7 using namespace clang; 7 using namespace clang;
8 8
9 namespace { 9 namespace {
10 10
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 120
121 const char kBaseRequiresFinalizationNote[] = 121 const char kBaseRequiresFinalizationNote[] =
122 "[blink-gc] Base class %0 requiring finalization declared here:"; 122 "[blink-gc] Base class %0 requiring finalization declared here:";
123 123
124 const char kFieldRequiresFinalizationNote[] = 124 const char kFieldRequiresFinalizationNote[] =
125 "[blink-gc] Field %0 requiring finalization declared here:"; 125 "[blink-gc] Field %0 requiring finalization declared here:";
126 126
127 const char kManualDispatchMethodNote[] = 127 const char kManualDispatchMethodNote[] =
128 "[blink-gc] Manual dispatch %0 declared here:"; 128 "[blink-gc] Manual dispatch %0 declared here:";
129 129
130 const char kDerivesNonStackAllocated[] = 130 const char kStackAllocatedDerivesGarbageCollected[] =
131 "[blink-gc] Stack-allocated class %0 derives class %1" 131 "[blink-gc] Stack-allocated class %0 derives class %1"
132 " which is not stack allocated."; 132 " which is garbage collected.";
133 133
134 const char kClassOverridesNew[] = 134 const char kClassOverridesNew[] =
135 "[blink-gc] Garbage collected class %0" 135 "[blink-gc] Garbage collected class %0"
136 " is not permitted to override its new operator."; 136 " is not permitted to override its new operator.";
137 137
138 const char kClassDeclaresPureVirtualTrace[] = 138 const char kClassDeclaresPureVirtualTrace[] =
139 "[blink-gc] Garbage collected class %0" 139 "[blink-gc] Garbage collected class %0"
140 " is not permitted to declare a pure-virtual trace method."; 140 " is not permitted to declare a pure-virtual trace method.";
141 141
142 const char kLeftMostBaseMustBePolymorphic[] = 142 const char kLeftMostBaseMustBePolymorphic[] =
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 diag_missing_trace_dispatch_method_ = diagnostic_.getCustomDiagID( 190 diag_missing_trace_dispatch_method_ = diagnostic_.getCustomDiagID(
191 getErrorLevel(), kMissingTraceDispatchMethod); 191 getErrorLevel(), kMissingTraceDispatchMethod);
192 diag_missing_finalize_dispatch_method_ = diagnostic_.getCustomDiagID( 192 diag_missing_finalize_dispatch_method_ = diagnostic_.getCustomDiagID(
193 getErrorLevel(), kMissingFinalizeDispatchMethod); 193 getErrorLevel(), kMissingFinalizeDispatchMethod);
194 diag_virtual_and_manual_dispatch_ = 194 diag_virtual_and_manual_dispatch_ =
195 diagnostic_.getCustomDiagID(getErrorLevel(), kVirtualAndManualDispatch); 195 diagnostic_.getCustomDiagID(getErrorLevel(), kVirtualAndManualDispatch);
196 diag_missing_trace_dispatch_ = 196 diag_missing_trace_dispatch_ =
197 diagnostic_.getCustomDiagID(getErrorLevel(), kMissingTraceDispatch); 197 diagnostic_.getCustomDiagID(getErrorLevel(), kMissingTraceDispatch);
198 diag_missing_finalize_dispatch_ = 198 diag_missing_finalize_dispatch_ =
199 diagnostic_.getCustomDiagID(getErrorLevel(), kMissingFinalizeDispatch); 199 diagnostic_.getCustomDiagID(getErrorLevel(), kMissingFinalizeDispatch);
200 diag_derives_non_stack_allocated_ = 200 diag_stack_allocated_derives_gc_ = diagnostic_.getCustomDiagID(
201 diagnostic_.getCustomDiagID(getErrorLevel(), kDerivesNonStackAllocated); 201 getErrorLevel(), kStackAllocatedDerivesGarbageCollected);
202 diag_class_overrides_new_ = 202 diag_class_overrides_new_ =
203 diagnostic_.getCustomDiagID(getErrorLevel(), kClassOverridesNew); 203 diagnostic_.getCustomDiagID(getErrorLevel(), kClassOverridesNew);
204 diag_class_declares_pure_virtual_trace_ = diagnostic_.getCustomDiagID( 204 diag_class_declares_pure_virtual_trace_ = diagnostic_.getCustomDiagID(
205 getErrorLevel(), kClassDeclaresPureVirtualTrace); 205 getErrorLevel(), kClassDeclaresPureVirtualTrace);
206 diag_left_most_base_must_be_polymorphic_ = diagnostic_.getCustomDiagID( 206 diag_left_most_base_must_be_polymorphic_ = diagnostic_.getCustomDiagID(
207 getErrorLevel(), kLeftMostBaseMustBePolymorphic); 207 getErrorLevel(), kLeftMostBaseMustBePolymorphic);
208 diag_base_class_must_declare_virtual_trace_ = diagnostic_.getCustomDiagID( 208 diag_base_class_must_declare_virtual_trace_ = diagnostic_.getCustomDiagID(
209 getErrorLevel(), kBaseClassMustDeclareVirtualTrace); 209 getErrorLevel(), kBaseClassMustDeclareVirtualTrace);
210 210
211 // Register note messages. 211 // Register note messages.
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 ReportMissingDispatch(dispatch, receiver, diag_missing_finalize_dispatch_); 446 ReportMissingDispatch(dispatch, receiver, diag_missing_finalize_dispatch_);
447 } 447 }
448 448
449 void DiagnosticsReporter::ReportMissingDispatch( 449 void DiagnosticsReporter::ReportMissingDispatch(
450 const FunctionDecl* dispatch, 450 const FunctionDecl* dispatch,
451 RecordInfo* receiver, 451 RecordInfo* receiver,
452 unsigned error) { 452 unsigned error) {
453 ReportDiagnostic(dispatch->getLocStart(), error) << receiver->record(); 453 ReportDiagnostic(dispatch->getLocStart(), error) << receiver->record();
454 } 454 }
455 455
456 void DiagnosticsReporter::DerivesNonStackAllocated( 456 void DiagnosticsReporter::StackAllocatedDerivesGarbageCollected(
457 RecordInfo* info, 457 RecordInfo* info,
458 BasePoint* base) { 458 BasePoint* base) {
459 ReportDiagnostic(base->spec().getLocStart(), 459 ReportDiagnostic(base->spec().getLocStart(),
460 diag_derives_non_stack_allocated_) 460 diag_stack_allocated_derives_gc_)
461 << info->record() << base->info()->record(); 461 << info->record() << base->info()->record();
462 } 462 }
463 463
464 void DiagnosticsReporter::ClassOverridesNew( 464 void DiagnosticsReporter::ClassOverridesNew(
465 RecordInfo* info, 465 RecordInfo* info,
466 CXXMethodDecl* newop) { 466 CXXMethodDecl* newop) {
467 ReportDiagnostic(newop->getLocStart(), diag_class_overrides_new_) 467 ReportDiagnostic(newop->getLocStart(), diag_class_overrides_new_)
468 << info->record(); 468 << info->record();
469 } 469 }
470 470
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 void DiagnosticsReporter::NoteField(FieldDecl* field, unsigned note) { 552 void DiagnosticsReporter::NoteField(FieldDecl* field, unsigned note) {
553 ReportDiagnostic(field->getLocStart(), note) << field; 553 ReportDiagnostic(field->getLocStart(), note) << field;
554 } 554 }
555 555
556 void DiagnosticsReporter::NoteOverriddenNonVirtualTrace( 556 void DiagnosticsReporter::NoteOverriddenNonVirtualTrace(
557 CXXMethodDecl* overridden) { 557 CXXMethodDecl* overridden) {
558 ReportDiagnostic(overridden->getLocStart(), 558 ReportDiagnostic(overridden->getLocStart(),
559 diag_overridden_non_virtual_trace_note_) 559 diag_overridden_non_virtual_trace_note_)
560 << overridden; 560 << overridden;
561 } 561 }
OLDNEW
« no previous file with comments | « tools/clang/blink_gc_plugin/DiagnosticsReporter.h ('k') | tools/clang/blink_gc_plugin/tests/stack_allocated.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698