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

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

Issue 1645613003: Emit notes from ReportClassRequiresTraceMethod in deterministic order (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/clang/blink_gc_plugin/BlinkGCPluginConsumer.cpp
diff --git a/tools/clang/blink_gc_plugin/BlinkGCPluginConsumer.cpp b/tools/clang/blink_gc_plugin/BlinkGCPluginConsumer.cpp
index c90510e93d76fc67c8c98b886e7981f8bf61c4c0..6c52c7712a722b70ea744acc68675f01bb5d0e4f 100644
--- a/tools/clang/blink_gc_plugin/BlinkGCPluginConsumer.cpp
+++ b/tools/clang/blink_gc_plugin/BlinkGCPluginConsumer.cpp
@@ -973,19 +973,23 @@ void BlinkGCPluginConsumer::ReportClassRequiresTraceMethod(RecordInfo* info) {
diag_class_requires_trace_method_)
<< info->record();
- for (RecordInfo::Bases::iterator it = info->GetBases().begin();
- it != info->GetBases().end();
- ++it) {
- if (it->second.NeedsTracing().IsNeeded())
- NoteBaseRequiresTracing(&it->second);
+ // Use an intermediate map to sort the notes by source location.
+ std::map<clang::SourceLocation, BasePoint*> BaseNotes;
+ for (auto& pair : info->GetBases()) {
+ if (pair.second.NeedsTracing().IsNeeded())
+ BaseNotes.insert(std::make_pair(pair.first->getLocStart(), &pair.second));
}
-
- for (RecordInfo::Fields::iterator it = info->GetFields().begin();
- it != info->GetFields().end();
- ++it) {
- if (!it->second.IsProperlyTraced())
- NoteFieldRequiresTracing(info, it->first);
+ for (auto& pair : BaseNotes)
+ NoteBaseRequiresTracing(pair.second);
+
+ // Use an intermediate map to sort the notes by source location.
+ std::map<clang::SourceLocation, clang::FieldDecl*> FieldNotes;
+ for (auto& pair : info->GetFields()) {
+ if (!pair.second.IsProperlyTraced())
+ FieldNotes.insert(std::make_pair(pair.first->getLocStart(), pair.first));
}
+ for (auto& pair : FieldNotes)
+ NoteFieldRequiresTracing(info, pair.second);
}
void BlinkGCPluginConsumer::ReportBaseRequiresTracing(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698