Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 206 diag_class_must_left_mostly_derive_gc_ = diagnostic_.getCustomDiagID( | 206 diag_class_must_left_mostly_derive_gc_ = diagnostic_.getCustomDiagID( |
| 207 getErrorLevel(), kClassMustLeftMostlyDeriveGC); | 207 getErrorLevel(), kClassMustLeftMostlyDeriveGC); |
| 208 diag_class_requires_trace_method_ = | 208 diag_class_requires_trace_method_ = |
| 209 diagnostic_.getCustomDiagID(getErrorLevel(), kClassRequiresTraceMethod); | 209 diagnostic_.getCustomDiagID(getErrorLevel(), kClassRequiresTraceMethod); |
| 210 diag_base_requires_tracing_ = | 210 diag_base_requires_tracing_ = |
| 211 diagnostic_.getCustomDiagID(getErrorLevel(), kBaseRequiresTracing); | 211 diagnostic_.getCustomDiagID(getErrorLevel(), kBaseRequiresTracing); |
| 212 diag_fields_require_tracing_ = | 212 diag_fields_require_tracing_ = |
| 213 diagnostic_.getCustomDiagID(getErrorLevel(), kFieldsRequireTracing); | 213 diagnostic_.getCustomDiagID(getErrorLevel(), kFieldsRequireTracing); |
| 214 diag_class_contains_invalid_fields_ = diagnostic_.getCustomDiagID( | 214 diag_class_contains_invalid_fields_ = diagnostic_.getCustomDiagID( |
| 215 getErrorLevel(), kClassContainsInvalidFields); | 215 getErrorLevel(), kClassContainsInvalidFields); |
| 216 diag_class_contains_invalid_fields_warning_ = diagnostic_.getCustomDiagID( | 216 diag_class_contains_invalid_fields_warning_ = diagnostic_.getCustomDiagID( |
|
Nico
2016/04/19 15:07:59
can this field go away now too?
sof
2016/04/19 15:22:24
I considered it as it now-unused, but left it in.
Nico
2016/04/19 15:24:04
I'd remove it if it's unused.
sof
2016/04/19 15:36:56
I thought it had some finely crafted warning messa
| |
| 217 getErrorLevel(), kClassContainsInvalidFields); | 217 getErrorLevel(), kClassContainsInvalidFields); |
| 218 diag_class_contains_gc_root_ = | 218 diag_class_contains_gc_root_ = |
| 219 diagnostic_.getCustomDiagID(getErrorLevel(), kClassContainsGCRoot); | 219 diagnostic_.getCustomDiagID(getErrorLevel(), kClassContainsGCRoot); |
| 220 diag_class_requires_finalization_ = diagnostic_.getCustomDiagID( | 220 diag_class_requires_finalization_ = diagnostic_.getCustomDiagID( |
| 221 getErrorLevel(), kClassRequiresFinalization); | 221 getErrorLevel(), kClassRequiresFinalization); |
| 222 diag_class_does_not_require_finalization_ = diagnostic_.getCustomDiagID( | 222 diag_class_does_not_require_finalization_ = diagnostic_.getCustomDiagID( |
| 223 DiagnosticsEngine::Warning, kClassDoesNotRequireFinalization); | 223 DiagnosticsEngine::Warning, kClassDoesNotRequireFinalization); |
| 224 diag_finalizer_accesses_finalized_field_ = diagnostic_.getCustomDiagID( | 224 diag_finalizer_accesses_finalized_field_ = diagnostic_.getCustomDiagID( |
| 225 getErrorLevel(), kFinalizerAccessesFinalizedField); | 225 getErrorLevel(), kFinalizerAccessesFinalizedField); |
| 226 diag_finalizer_eagerly_finalized_field_ = diagnostic_.getCustomDiagID( | 226 diag_finalizer_eagerly_finalized_field_ = diagnostic_.getCustomDiagID( |
| (...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 957 ReportDiagnostic(trace->getLocStart(), diag_fields_require_tracing_) | 957 ReportDiagnostic(trace->getLocStart(), diag_fields_require_tracing_) |
| 958 << info->record(); | 958 << info->record(); |
| 959 for (auto& field : info->GetFields()) | 959 for (auto& field : info->GetFields()) |
| 960 if (!field.second.IsProperlyTraced()) | 960 if (!field.second.IsProperlyTraced()) |
| 961 NoteFieldRequiresTracing(info, field.first); | 961 NoteFieldRequiresTracing(info, field.first); |
| 962 } | 962 } |
| 963 | 963 |
| 964 void BlinkGCPluginConsumer::ReportClassContainsInvalidFields( | 964 void BlinkGCPluginConsumer::ReportClassContainsInvalidFields( |
| 965 RecordInfo* info, | 965 RecordInfo* info, |
| 966 const CheckFieldsVisitor::Errors& errors) { | 966 const CheckFieldsVisitor::Errors& errors) { |
| 967 bool only_warnings = options_.warn_raw_ptr; | |
| 968 for (auto& error : errors) | |
| 969 if (!CheckFieldsVisitor::IsWarning(error.second)) | |
| 970 only_warnings = false; | |
| 971 | 967 |
| 972 ReportDiagnostic(info->record()->getLocStart(), | 968 ReportDiagnostic(info->record()->getLocStart(), |
| 973 only_warnings ? | |
| 974 diag_class_contains_invalid_fields_warning_ : | |
| 975 diag_class_contains_invalid_fields_) | 969 diag_class_contains_invalid_fields_) |
| 976 << info->record(); | 970 << info->record(); |
| 977 | 971 |
| 978 for (auto& error : errors) { | 972 for (auto& error : errors) { |
| 979 unsigned note; | 973 unsigned note; |
| 980 if (CheckFieldsVisitor::IsRawPtrError(error.second)) { | 974 if (error.second == CheckFieldsVisitor::kRawPtrToGCManaged) { |
| 981 note = diag_raw_ptr_to_gc_managed_class_note_; | 975 note = diag_raw_ptr_to_gc_managed_class_note_; |
| 982 } else if (CheckFieldsVisitor::IsReferencePtrError(error.second)) { | |
| 983 note = diag_reference_ptr_to_gc_managed_class_note_; | |
| 984 } else if (error.second == CheckFieldsVisitor::kRefPtrToGCManaged) { | 976 } else if (error.second == CheckFieldsVisitor::kRefPtrToGCManaged) { |
| 985 note = diag_ref_ptr_to_gc_managed_class_note_; | 977 note = diag_ref_ptr_to_gc_managed_class_note_; |
| 978 } else if (error.second == CheckFieldsVisitor::kReferencePtrToGCManaged) { | |
| 979 note = diag_reference_ptr_to_gc_managed_class_note_; | |
| 986 } else if (error.second == CheckFieldsVisitor::kOwnPtrToGCManaged) { | 980 } else if (error.second == CheckFieldsVisitor::kOwnPtrToGCManaged) { |
| 987 note = diag_own_ptr_to_gc_managed_class_note_; | 981 note = diag_own_ptr_to_gc_managed_class_note_; |
| 988 } else if (error.second == CheckFieldsVisitor::kMemberToGCUnmanaged) { | 982 } else if (error.second == CheckFieldsVisitor::kMemberToGCUnmanaged) { |
| 989 note = diag_member_to_gc_unmanaged_class_note_; | 983 note = diag_member_to_gc_unmanaged_class_note_; |
| 990 } else if (error.second == CheckFieldsVisitor::kMemberInUnmanaged) { | 984 } else if (error.second == CheckFieldsVisitor::kMemberInUnmanaged) { |
| 991 note = diag_member_in_unmanaged_class_note_; | 985 note = diag_member_in_unmanaged_class_note_; |
| 992 } else if (error.second == CheckFieldsVisitor::kPtrFromHeapToStack) { | 986 } else if (error.second == CheckFieldsVisitor::kPtrFromHeapToStack) { |
| 993 note = diag_stack_allocated_field_note_; | 987 note = diag_stack_allocated_field_note_; |
| 994 } else if (error.second == CheckFieldsVisitor::kGCDerivedPartObject) { | 988 } else if (error.second == CheckFieldsVisitor::kGCDerivedPartObject) { |
| 995 note = diag_part_object_to_gc_derived_class_note_; | 989 note = diag_part_object_to_gc_derived_class_note_; |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1192 void BlinkGCPluginConsumer::NoteField(FieldDecl* field, unsigned note) { | 1186 void BlinkGCPluginConsumer::NoteField(FieldDecl* field, unsigned note) { |
| 1193 ReportDiagnostic(field->getLocStart(), note) << field; | 1187 ReportDiagnostic(field->getLocStart(), note) << field; |
| 1194 } | 1188 } |
| 1195 | 1189 |
| 1196 void BlinkGCPluginConsumer::NoteOverriddenNonVirtualTrace( | 1190 void BlinkGCPluginConsumer::NoteOverriddenNonVirtualTrace( |
| 1197 CXXMethodDecl* overridden) { | 1191 CXXMethodDecl* overridden) { |
| 1198 ReportDiagnostic(overridden->getLocStart(), | 1192 ReportDiagnostic(overridden->getLocStart(), |
| 1199 diag_overridden_non_virtual_trace_note_) | 1193 diag_overridden_non_virtual_trace_note_) |
| 1200 << overridden; | 1194 << overridden; |
| 1201 } | 1195 } |
| OLD | NEW |