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 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
966 ReportDiagnostic(info->record()->getInnerLocStart(), | 966 ReportDiagnostic(info->record()->getInnerLocStart(), |
967 diag_class_must_left_mostly_derive_gc_) | 967 diag_class_must_left_mostly_derive_gc_) |
968 << info->record(); | 968 << info->record(); |
969 } | 969 } |
970 | 970 |
971 void BlinkGCPluginConsumer::ReportClassRequiresTraceMethod(RecordInfo* info) { | 971 void BlinkGCPluginConsumer::ReportClassRequiresTraceMethod(RecordInfo* info) { |
972 ReportDiagnostic(info->record()->getInnerLocStart(), | 972 ReportDiagnostic(info->record()->getInnerLocStart(), |
973 diag_class_requires_trace_method_) | 973 diag_class_requires_trace_method_) |
974 << info->record(); | 974 << info->record(); |
975 | 975 |
976 // Use an intermediate map to sort the notes by source location. | 976 for (RecordInfo::Bases::iterator it = info->GetBases().begin(); |
977 std::map<clang::SourceLocation, BasePoint*> BaseNotes; | 977 it != info->GetBases().end(); |
978 for (auto& pair : info->GetBases()) { | 978 ++it) { |
979 if (pair.second.NeedsTracing().IsNeeded()) | 979 if (it->second.NeedsTracing().IsNeeded()) |
980 BaseNotes.insert(std::make_pair(pair.first->getLocStart(), &pair.second)); | 980 NoteBaseRequiresTracing(&it->second); |
981 } | 981 } |
982 for (auto& pair : BaseNotes) | |
983 NoteBaseRequiresTracing(pair.second); | |
984 | 982 |
985 // Use an intermediate map to sort the notes by source location. | 983 for (RecordInfo::Fields::iterator it = info->GetFields().begin(); |
986 std::map<clang::SourceLocation, clang::FieldDecl*> FieldNotes; | 984 it != info->GetFields().end(); |
987 for (auto& pair : info->GetFields()) { | 985 ++it) { |
988 if (!pair.second.IsProperlyTraced()) | 986 if (!it->second.IsProperlyTraced()) |
989 FieldNotes.insert(std::make_pair(pair.first->getLocStart(), pair.first)); | 987 NoteFieldRequiresTracing(info, it->first); |
990 } | 988 } |
991 for (auto& pair : FieldNotes) | |
992 NoteFieldRequiresTracing(info, pair.second); | |
993 } | 989 } |
994 | 990 |
995 void BlinkGCPluginConsumer::ReportBaseRequiresTracing( | 991 void BlinkGCPluginConsumer::ReportBaseRequiresTracing( |
996 RecordInfo* derived, | 992 RecordInfo* derived, |
997 CXXMethodDecl* trace, | 993 CXXMethodDecl* trace, |
998 CXXRecordDecl* base) { | 994 CXXRecordDecl* base) { |
999 ReportDiagnostic(trace->getLocStart(), diag_base_requires_tracing_) | 995 ReportDiagnostic(trace->getLocStart(), diag_base_requires_tracing_) |
1000 << base << derived->record(); | 996 << base << derived->record(); |
1001 } | 997 } |
1002 | 998 |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1249 void BlinkGCPluginConsumer::NoteField(FieldDecl* field, unsigned note) { | 1245 void BlinkGCPluginConsumer::NoteField(FieldDecl* field, unsigned note) { |
1250 ReportDiagnostic(field->getLocStart(), note) << field; | 1246 ReportDiagnostic(field->getLocStart(), note) << field; |
1251 } | 1247 } |
1252 | 1248 |
1253 void BlinkGCPluginConsumer::NoteOverriddenNonVirtualTrace( | 1249 void BlinkGCPluginConsumer::NoteOverriddenNonVirtualTrace( |
1254 CXXMethodDecl* overridden) { | 1250 CXXMethodDecl* overridden) { |
1255 ReportDiagnostic(overridden->getLocStart(), | 1251 ReportDiagnostic(overridden->getLocStart(), |
1256 diag_overridden_non_virtual_trace_note_) | 1252 diag_overridden_non_virtual_trace_note_) |
1257 << overridden; | 1253 << overridden; |
1258 } | 1254 } |
OLD | NEW |