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

Unified Diff: tools/clang/blink_gc_plugin/DiagnosticsReporter.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/clang/blink_gc_plugin/DiagnosticsReporter.h ('k') | tools/clang/blink_gc_plugin/tests/.gitignore » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 a43cfdb0d91a9065cd592bdcbcc410f1b39dd50a..95d5595beb5f38ffe8f690c98a710a3dee062971 100644
--- a/tools/clang/blink_gc_plugin/DiagnosticsReporter.cpp
+++ b/tools/clang/blink_gc_plugin/DiagnosticsReporter.cpp
@@ -150,6 +150,10 @@ const char kBaseClassMustDeclareVirtualTrace[] =
const char kIteratorToGCManagedCollectionNote[] =
"[blink-gc] Iterator field %0 to a GC managed collection declared here:";
+const char kTraceMethodOfStackAllocatedParentNote[] =
+ "[blink-gc] The stack allocated class %0 provides an unnecessary "
+ "trace method:";
+
} // namespace
DiagnosticBuilder DiagnosticsReporter::ReportDiagnostic(
@@ -212,6 +216,8 @@ DiagnosticsReporter::DiagnosticsReporter(
getErrorLevel(), kBaseClassMustDeclareVirtualTrace);
diag_iterator_to_gc_managed_collection_note_ = diagnostic_.getCustomDiagID(
getErrorLevel(), kIteratorToGCManagedCollectionNote);
+ diag_trace_method_of_stack_allocated_parent_ = diagnostic_.getCustomDiagID(
+ getErrorLevel(), kTraceMethodOfStackAllocatedParentNote);
// Register note messages.
diag_base_requires_tracing_note_ = diagnostic_.getCustomDiagID(
@@ -499,6 +505,14 @@ void DiagnosticsReporter::BaseClassMustDeclareVirtualTrace(
<< base << derived->record();
}
+void DiagnosticsReporter::TraceMethodForStackAllocatedClass(
+ RecordInfo* info,
+ CXXMethodDecl* trace) {
+ ReportDiagnostic(trace->getLocStart(),
+ diag_trace_method_of_stack_allocated_parent_)
+ << info->record();
+}
+
void DiagnosticsReporter::NoteManualDispatchMethod(CXXMethodDecl* dispatch) {
ReportDiagnostic(dispatch->getLocStart(),
diag_manual_dispatch_method_note_)
« no previous file with comments | « tools/clang/blink_gc_plugin/DiagnosticsReporter.h ('k') | tools/clang/blink_gc_plugin/tests/.gitignore » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698