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