| 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 #ifndef TOOLS_BLINK_GC_PLUGIN_BLINK_GC_PLUGIN_CONSUMER_H_ | 5 #ifndef TOOLS_BLINK_GC_PLUGIN_BLINK_GC_PLUGIN_CONSUMER_H_ |
| 6 #define TOOLS_BLINK_GC_PLUGIN_BLINK_GC_PLUGIN_CONSUMER_H_ | 6 #define TOOLS_BLINK_GC_PLUGIN_BLINK_GC_PLUGIN_CONSUMER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "BlinkGCPluginOptions.h" | 10 #include "BlinkGCPluginOptions.h" |
| 11 #include "CheckFieldsVisitor.h" | |
| 12 #include "CheckFinalizerVisitor.h" | |
| 13 #include "CheckGCRootsVisitor.h" | |
| 14 #include "Config.h" | 11 #include "Config.h" |
| 12 #include "DiagnosticsReporter.h" |
| 15 #include "clang/AST/AST.h" | 13 #include "clang/AST/AST.h" |
| 16 #include "clang/AST/ASTConsumer.h" | 14 #include "clang/AST/ASTConsumer.h" |
| 17 #include "clang/Basic/Diagnostic.h" | 15 #include "clang/Basic/Diagnostic.h" |
| 18 #include "clang/Frontend/CompilerInstance.h" | 16 #include "clang/Frontend/CompilerInstance.h" |
| 19 | 17 |
| 20 class JsonWriter; | 18 class JsonWriter; |
| 21 class RecordInfo; | 19 class RecordInfo; |
| 22 | 20 |
| 23 // Main class containing checks for various invariants of the Blink | 21 // Main class containing checks for various invariants of the Blink |
| 24 // garbage collection infrastructure. | 22 // garbage collection infrastructure. |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 clang::CXXMethodDecl* trace, | 66 clang::CXXMethodDecl* trace, |
| 69 Config::TraceMethodType trace_type); | 67 Config::TraceMethodType trace_type); |
| 70 | 68 |
| 71 void DumpClass(RecordInfo* info); | 69 void DumpClass(RecordInfo* info); |
| 72 | 70 |
| 73 // Adds either a warning or error, based on the current handling of -Werror. | 71 // Adds either a warning or error, based on the current handling of -Werror. |
| 74 clang::DiagnosticsEngine::Level getErrorLevel(); | 72 clang::DiagnosticsEngine::Level getErrorLevel(); |
| 75 | 73 |
| 76 std::string GetLocString(clang::SourceLocation loc); | 74 std::string GetLocString(clang::SourceLocation loc); |
| 77 | 75 |
| 78 bool IsIgnored(RecordInfo* record); | 76 bool IsIgnored(RecordInfo* info); |
| 79 | 77 |
| 80 bool IsIgnoredClass(RecordInfo* info); | 78 bool IsIgnoredClass(RecordInfo* info); |
| 81 | 79 |
| 82 bool InIgnoredDirectory(RecordInfo* info); | 80 bool InIgnoredDirectory(RecordInfo* info); |
| 83 | 81 |
| 84 bool InCheckedNamespace(RecordInfo* info); | 82 bool InCheckedNamespace(RecordInfo* info); |
| 85 | 83 |
| 86 bool GetFilename(clang::SourceLocation loc, std::string* filename); | 84 bool GetFilename(clang::SourceLocation loc, std::string* filename); |
| 87 | 85 |
| 88 clang::DiagnosticBuilder ReportDiagnostic( | |
| 89 clang::SourceLocation location, | |
| 90 unsigned diag_id); | |
| 91 | |
| 92 void ReportClassMustLeftMostlyDeriveGC(RecordInfo* info); | |
| 93 void ReportClassRequiresTraceMethod(RecordInfo* info); | |
| 94 void ReportBaseRequiresTracing(RecordInfo* derived, | |
| 95 clang::CXXMethodDecl* trace, | |
| 96 clang::CXXRecordDecl* base); | |
| 97 void ReportFieldsRequireTracing(RecordInfo* info, | |
| 98 clang::CXXMethodDecl* trace); | |
| 99 void ReportClassContainsInvalidFields( | |
| 100 RecordInfo* info, | |
| 101 const CheckFieldsVisitor::Errors& errors); | |
| 102 void ReportClassContainsGCRoots(RecordInfo* info, | |
| 103 const CheckGCRootsVisitor::Errors& errors); | |
| 104 void ReportFinalizerAccessesFinalizedFields( | |
| 105 clang::CXXMethodDecl* dtor, | |
| 106 const CheckFinalizerVisitor::Errors& errors); | |
| 107 void ReportClassRequiresFinalization(RecordInfo* info); | |
| 108 void ReportClassDoesNotRequireFinalization(RecordInfo* info); | |
| 109 void ReportClassMustDeclareGCMixinTraceMethod(RecordInfo* info); | |
| 110 void ReportOverriddenNonVirtualTrace(RecordInfo* info, | |
| 111 clang::CXXMethodDecl* trace, | |
| 112 clang::CXXMethodDecl* overridden); | |
| 113 void ReportMissingTraceDispatchMethod(RecordInfo* info); | |
| 114 void ReportMissingFinalizeDispatchMethod(RecordInfo* info); | |
| 115 void ReportMissingDispatchMethod(RecordInfo* info, unsigned error); | |
| 116 void ReportVirtualAndManualDispatch(RecordInfo* info, | |
| 117 clang::CXXMethodDecl* dispatch); | |
| 118 void ReportMissingTraceDispatch(const clang::FunctionDecl* dispatch, | |
| 119 RecordInfo* receiver); | |
| 120 void ReportMissingFinalizeDispatch(const clang::FunctionDecl* dispatch, | |
| 121 RecordInfo* receiver); | |
| 122 void ReportMissingDispatch(const clang::FunctionDecl* dispatch, | |
| 123 RecordInfo* receiver, | |
| 124 unsigned error); | |
| 125 void ReportDerivesNonStackAllocated(RecordInfo* info, BasePoint* base); | |
| 126 void ReportClassOverridesNew(RecordInfo* info, clang::CXXMethodDecl* newop); | |
| 127 void ReportClassDeclaresPureVirtualTrace(RecordInfo* info, | |
| 128 clang::CXXMethodDecl* trace); | |
| 129 void ReportLeftMostBaseMustBePolymorphic(RecordInfo* derived, | |
| 130 clang::CXXRecordDecl* base); | |
| 131 void ReportBaseClassMustDeclareVirtualTrace(RecordInfo* derived, | |
| 132 clang::CXXRecordDecl* base); | |
| 133 void NoteManualDispatchMethod(clang::CXXMethodDecl* dispatch); | |
| 134 void NoteBaseRequiresTracing(BasePoint* base); | |
| 135 void NoteFieldRequiresTracing(RecordInfo* holder, clang::FieldDecl* field); | |
| 136 void NotePartObjectContainsGCRoot(FieldPoint* point); | |
| 137 void NoteFieldContainsGCRoot(FieldPoint* point); | |
| 138 void NoteUserDeclaredDestructor(clang::CXXMethodDecl* dtor); | |
| 139 void NoteUserDeclaredFinalizer(clang::CXXMethodDecl* dtor); | |
| 140 void NoteBaseRequiresFinalization(BasePoint* base); | |
| 141 void NoteField(FieldPoint* point, unsigned note); | |
| 142 void NoteField(clang::FieldDecl* field, unsigned note); | |
| 143 void NoteOverriddenNonVirtualTrace(clang::CXXMethodDecl* overridden); | |
| 144 | |
| 145 unsigned diag_class_must_left_mostly_derive_gc_; | |
| 146 unsigned diag_class_requires_trace_method_; | |
| 147 unsigned diag_base_requires_tracing_; | |
| 148 unsigned diag_fields_require_tracing_; | |
| 149 unsigned diag_class_contains_invalid_fields_; | |
| 150 unsigned diag_class_contains_gc_root_; | |
| 151 unsigned diag_class_requires_finalization_; | |
| 152 unsigned diag_class_does_not_require_finalization_; | |
| 153 unsigned diag_finalizer_accesses_finalized_field_; | |
| 154 unsigned diag_finalizer_eagerly_finalized_field_; | |
| 155 unsigned diag_overridden_non_virtual_trace_; | |
| 156 unsigned diag_missing_trace_dispatch_method_; | |
| 157 unsigned diag_missing_finalize_dispatch_method_; | |
| 158 unsigned diag_virtual_and_manual_dispatch_; | |
| 159 unsigned diag_missing_trace_dispatch_; | |
| 160 unsigned diag_missing_finalize_dispatch_; | |
| 161 unsigned diag_derives_non_stack_allocated_; | |
| 162 unsigned diag_class_overrides_new_; | |
| 163 unsigned diag_class_declares_pure_virtual_trace_; | |
| 164 unsigned diag_left_most_base_must_be_polymorphic_; | |
| 165 unsigned diag_base_class_must_declare_virtual_trace_; | |
| 166 | |
| 167 unsigned diag_base_requires_tracing_note_; | |
| 168 unsigned diag_field_requires_tracing_note_; | |
| 169 unsigned diag_raw_ptr_to_gc_managed_class_note_; | |
| 170 unsigned diag_ref_ptr_to_gc_managed_class_note_; | |
| 171 unsigned diag_reference_ptr_to_gc_managed_class_note_; | |
| 172 unsigned diag_own_ptr_to_gc_managed_class_note_; | |
| 173 unsigned diag_member_to_gc_unmanaged_class_note_; | |
| 174 unsigned diag_stack_allocated_field_note_; | |
| 175 unsigned diag_member_in_unmanaged_class_note_; | |
| 176 unsigned diag_part_object_to_gc_derived_class_note_; | |
| 177 unsigned diag_part_object_contains_gc_root_note_; | |
| 178 unsigned diag_field_contains_gc_root_note_; | |
| 179 unsigned diag_finalized_field_note_; | |
| 180 unsigned diag_eagerly_finalized_field_note_; | |
| 181 unsigned diag_user_declared_destructor_note_; | |
| 182 unsigned diag_user_declared_finalizer_note_; | |
| 183 unsigned diag_base_requires_finalization_note_; | |
| 184 unsigned diag_field_requires_finalization_note_; | |
| 185 unsigned diag_overridden_non_virtual_trace_note_; | |
| 186 unsigned diag_manual_dispatch_method_note_; | |
| 187 | |
| 188 clang::CompilerInstance& instance_; | 86 clang::CompilerInstance& instance_; |
| 189 clang::DiagnosticsEngine& diagnostic_; | 87 DiagnosticsReporter reporter_; |
| 190 BlinkGCPluginOptions options_; | 88 BlinkGCPluginOptions options_; |
| 191 RecordCache cache_; | 89 RecordCache cache_; |
| 192 JsonWriter* json_; | 90 JsonWriter* json_; |
| 193 }; | 91 }; |
| 194 | 92 |
| 195 | |
| 196 #endif // TOOLS_BLINK_GC_PLUGIN_BLINK_GC_PLUGIN_CONSUMER_H_ | 93 #endif // TOOLS_BLINK_GC_PLUGIN_BLINK_GC_PLUGIN_CONSUMER_H_ |
| OLD | NEW |