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

Unified Diff: tools/clang/blink_gc_plugin/DiagnosticsReporter.cpp

Issue 2588943002: Disallow heap objects containing unsafe on-heap iterators. (Closed)
Patch Set: formatting Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: tools/clang/blink_gc_plugin/DiagnosticsReporter.cpp
diff --git a/tools/clang/blink_gc_plugin/DiagnosticsReporter.cpp b/tools/clang/blink_gc_plugin/DiagnosticsReporter.cpp
index bd46f2c78745940e2c13677b0cda71cb5b294c2c..1ae842573ff442ab414815d5bf70461b9b5845f5 100644
--- a/tools/clang/blink_gc_plugin/DiagnosticsReporter.cpp
+++ b/tools/clang/blink_gc_plugin/DiagnosticsReporter.cpp
@@ -147,6 +147,9 @@ const char kBaseClassMustDeclareVirtualTrace[] =
"[blink-gc] Left-most base class %0 of derived class %1"
" must define a virtual trace method.";
+const char kIteratorToGCManagedCollectionNote[] =
+ "[blink-gc] Iterator field %0 to a GC managed collection declared here:";
+
} // namespace
DiagnosticBuilder DiagnosticsReporter::ReportDiagnostic(
@@ -253,6 +256,8 @@ DiagnosticsReporter::DiagnosticsReporter(
DiagnosticsEngine::Note, kOverriddenNonVirtualTraceNote);
diag_manual_dispatch_method_note_ = diagnostic_.getCustomDiagID(
DiagnosticsEngine::Note, kManualDispatchMethodNote);
+ diag_iterator_to_gc_managed_collection_note_ = diagnostic_.getCustomDiagID(
+ DiagnosticsEngine::Note, kIteratorToGCManagedCollectionNote);
}
bool DiagnosticsReporter::hasErrorOccurred() const
@@ -343,6 +348,8 @@ void DiagnosticsReporter::ClassContainsInvalidFields(
note = diag_stack_allocated_field_note_;
} else if (error.second == CheckFieldsVisitor::kGCDerivedPartObject) {
note = diag_part_object_to_gc_derived_class_note_;
+ } else if (error.second == CheckFieldsVisitor::kIteratorToGCManaged) {
+ note = diag_iterator_to_gc_managed_collection_note_;
} else {
assert(false && "Unknown field error");
}

Powered by Google App Engine
This is Rietveld 408576698