Commit f544ddc9 authored by hans's avatar hans Committed by Commit bot

Emit notes from ReportClassRequiresTraceMethod in deterministic order

Previously, the notes would be emitted in the iteration order over Fields,
which is an std::map<clang::FieldDecl*, FieldPoint>, which is ordered
by pointer value of FieldDecls. This would cause tests to flakily fail
on the Windows buildbots.

I'm not sure what caused these errors to start appearing right now,
but this should fix it.

BUG=581782

Review URL: https://codereview.chromium.org/1645613003

Cr-Commit-Position: refs/heads/master@{#372016}
parent 526d14e6
...@@ -973,19 +973,23 @@ void BlinkGCPluginConsumer::ReportClassRequiresTraceMethod(RecordInfo* info) { ...@@ -973,19 +973,23 @@ void BlinkGCPluginConsumer::ReportClassRequiresTraceMethod(RecordInfo* info) {
diag_class_requires_trace_method_) diag_class_requires_trace_method_)
<< info->record(); << info->record();
for (RecordInfo::Bases::iterator it = info->GetBases().begin(); // Use an intermediate map to sort the notes by source location.
it != info->GetBases().end(); std::map<clang::SourceLocation, BasePoint*> BaseNotes;
++it) { for (auto& pair : info->GetBases()) {
if (it->second.NeedsTracing().IsNeeded()) if (pair.second.NeedsTracing().IsNeeded())
NoteBaseRequiresTracing(&it->second); BaseNotes.insert(std::make_pair(pair.first->getLocStart(), &pair.second));
} }
for (auto& pair : BaseNotes)
for (RecordInfo::Fields::iterator it = info->GetFields().begin(); NoteBaseRequiresTracing(pair.second);
it != info->GetFields().end();
++it) { // Use an intermediate map to sort the notes by source location.
if (!it->second.IsProperlyTraced()) std::map<clang::SourceLocation, clang::FieldDecl*> FieldNotes;
NoteFieldRequiresTracing(info, it->first); 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( void BlinkGCPluginConsumer::ReportBaseRequiresTracing(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment