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

Side by Side Diff: tools/clang/blink_gc_plugin/BlinkGCPluginConsumer.cpp

Issue 2060553002: GC plugin: improve error reporting when tracing illegal fields. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 unified diff | Download patch
OLDNEW
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 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 // traceImpl (or traceAfterDispatchImpl) method. We will report on 545 // traceImpl (or traceAfterDispatchImpl) method. We will report on
546 // CheckTraceMethod on traceImpl method. 546 // CheckTraceMethod on traceImpl method.
547 if (visitor.delegates_to_traceimpl()) 547 if (visitor.delegates_to_traceimpl())
548 return; 548 return;
549 549
550 for (auto& base : parent->GetBases()) 550 for (auto& base : parent->GetBases())
551 if (!base.second.IsProperlyTraced()) 551 if (!base.second.IsProperlyTraced())
552 reporter_.BaseRequiresTracing(parent, trace, base.first); 552 reporter_.BaseRequiresTracing(parent, trace, base.first);
553 553
554 for (auto& field : parent->GetFields()) { 554 for (auto& field : parent->GetFields()) {
555 if (!field.second.IsProperlyTraced()) { 555 if (!field.second.IsProperlyTraced() ||
556 // Discontinue once an untraced-field error is found. 556 field.second.IsInproperlyTraced()) {
557 reporter_.FieldsRequireTracing(parent, trace); 557 // Report one or more tracing-related field errors.
558 reporter_.FieldsImproperlyTraced(parent, trace);
558 break; 559 break;
559 } 560 }
560 } 561 }
561 } 562 }
562 563
563 void BlinkGCPluginConsumer::DumpClass(RecordInfo* info) { 564 void BlinkGCPluginConsumer::DumpClass(RecordInfo* info) {
564 if (!json_) 565 if (!json_)
565 return; 566 return;
566 567
567 json_->OpenObject(); 568 json_->OpenObject();
(...skipping 15 matching lines...) Expand all
583 json_->Write("lbl", lbl); 584 json_->Write("lbl", lbl);
584 json_->Write("kind", kind); 585 json_->Write("kind", kind);
585 json_->Write("loc", loc); 586 json_->Write("loc", loc);
586 json_->Write("ptr", 587 json_->Write("ptr",
587 !Parent() ? "val" : 588 !Parent() ? "val" :
588 Parent()->IsRawPtr() ? 589 Parent()->IsRawPtr() ?
589 (static_cast<RawPtr*>(Parent())->HasReferenceType() ? 590 (static_cast<RawPtr*>(Parent())->HasReferenceType() ?
590 "reference" : "raw") : 591 "reference" : "raw") :
591 Parent()->IsRefPtr() ? "ref" : 592 Parent()->IsRefPtr() ? "ref" :
592 Parent()->IsOwnPtr() ? "own" : 593 Parent()->IsOwnPtr() ? "own" :
594 Parent()->IsUniquePtr() ? "unique" :
593 (Parent()->IsMember() || Parent()->IsWeakMember()) ? "mem" : 595 (Parent()->IsMember() || Parent()->IsWeakMember()) ? "mem" :
594 "val"); 596 "val");
595 json_->CloseObject(); 597 json_->CloseObject();
596 } 598 }
597 599
598 void DumpField(RecordInfo* src, FieldPoint* point, const std::string& loc) { 600 void DumpField(RecordInfo* src, FieldPoint* point, const std::string& loc) {
599 src_ = src; 601 src_ = src;
600 point_ = point; 602 point_ = point;
601 loc_ = loc; 603 loc_ = loc;
602 point_->edge()->Accept(this); 604 point_->edge()->Accept(this);
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 SourceLocation spelling_location = source_manager.getSpellingLoc(loc); 714 SourceLocation spelling_location = source_manager.getSpellingLoc(loc);
713 PresumedLoc ploc = source_manager.getPresumedLoc(spelling_location); 715 PresumedLoc ploc = source_manager.getPresumedLoc(spelling_location);
714 if (ploc.isInvalid()) { 716 if (ploc.isInvalid()) {
715 // If we're in an invalid location, we're looking at things that aren't 717 // If we're in an invalid location, we're looking at things that aren't
716 // actually stated in the source. 718 // actually stated in the source.
717 return false; 719 return false;
718 } 720 }
719 *filename = ploc.getFilename(); 721 *filename = ploc.getFilename();
720 return true; 722 return true;
721 } 723 }
OLDNEW
« no previous file with comments | « no previous file | tools/clang/blink_gc_plugin/CheckFieldsVisitor.h » ('j') | tools/clang/blink_gc_plugin/RecordInfo.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698