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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 }; | 61 }; |
62 | 62 |
63 } // namespace | 63 } // namespace |
64 | 64 |
65 BlinkGCPluginConsumer::BlinkGCPluginConsumer( | 65 BlinkGCPluginConsumer::BlinkGCPluginConsumer( |
66 clang::CompilerInstance& instance, | 66 clang::CompilerInstance& instance, |
67 const BlinkGCPluginOptions& options) | 67 const BlinkGCPluginOptions& options) |
68 : instance_(instance), | 68 : instance_(instance), |
69 reporter_(instance), | 69 reporter_(instance), |
70 options_(options), | 70 options_(options), |
| 71 cache_(instance), |
71 json_(0) { | 72 json_(0) { |
72 // Only check structures in the blink and WebKit namespaces. | 73 // Only check structures in the blink and WebKit namespaces. |
73 options_.checked_namespaces.insert("blink"); | 74 options_.checked_namespaces.insert("blink"); |
74 | 75 |
75 // Ignore GC implementation files. | 76 // Ignore GC implementation files. |
76 options_.ignored_directories.push_back("/heap/"); | 77 options_.ignored_directories.push_back("/heap/"); |
77 } | 78 } |
78 | 79 |
79 void BlinkGCPluginConsumer::HandleTranslationUnit(ASTContext& context) { | 80 void BlinkGCPluginConsumer::HandleTranslationUnit(ASTContext& context) { |
80 // Don't run the plugin if the compilation unit is already invalid. | 81 // Don't run the plugin if the compilation unit is already invalid. |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 // traceImpl (or traceAfterDispatchImpl) method. We will report on | 546 // traceImpl (or traceAfterDispatchImpl) method. We will report on |
546 // CheckTraceMethod on traceImpl method. | 547 // CheckTraceMethod on traceImpl method. |
547 if (visitor.delegates_to_traceimpl()) | 548 if (visitor.delegates_to_traceimpl()) |
548 return; | 549 return; |
549 | 550 |
550 for (auto& base : parent->GetBases()) | 551 for (auto& base : parent->GetBases()) |
551 if (!base.second.IsProperlyTraced()) | 552 if (!base.second.IsProperlyTraced()) |
552 reporter_.BaseRequiresTracing(parent, trace, base.first); | 553 reporter_.BaseRequiresTracing(parent, trace, base.first); |
553 | 554 |
554 for (auto& field : parent->GetFields()) { | 555 for (auto& field : parent->GetFields()) { |
555 if (!field.second.IsProperlyTraced()) { | 556 if (!field.second.IsProperlyTraced() || |
556 // Discontinue once an untraced-field error is found. | 557 field.second.IsInproperlyTraced()) { |
557 reporter_.FieldsRequireTracing(parent, trace); | 558 // Report one or more tracing-related field errors. |
| 559 reporter_.FieldsImproperlyTraced(parent, trace); |
558 break; | 560 break; |
559 } | 561 } |
560 } | 562 } |
561 } | 563 } |
562 | 564 |
563 void BlinkGCPluginConsumer::DumpClass(RecordInfo* info) { | 565 void BlinkGCPluginConsumer::DumpClass(RecordInfo* info) { |
564 if (!json_) | 566 if (!json_) |
565 return; | 567 return; |
566 | 568 |
567 json_->OpenObject(); | 569 json_->OpenObject(); |
(...skipping 15 matching lines...) Expand all Loading... |
583 json_->Write("lbl", lbl); | 585 json_->Write("lbl", lbl); |
584 json_->Write("kind", kind); | 586 json_->Write("kind", kind); |
585 json_->Write("loc", loc); | 587 json_->Write("loc", loc); |
586 json_->Write("ptr", | 588 json_->Write("ptr", |
587 !Parent() ? "val" : | 589 !Parent() ? "val" : |
588 Parent()->IsRawPtr() ? | 590 Parent()->IsRawPtr() ? |
589 (static_cast<RawPtr*>(Parent())->HasReferenceType() ? | 591 (static_cast<RawPtr*>(Parent())->HasReferenceType() ? |
590 "reference" : "raw") : | 592 "reference" : "raw") : |
591 Parent()->IsRefPtr() ? "ref" : | 593 Parent()->IsRefPtr() ? "ref" : |
592 Parent()->IsOwnPtr() ? "own" : | 594 Parent()->IsOwnPtr() ? "own" : |
| 595 Parent()->IsUniquePtr() ? "unique" : |
593 (Parent()->IsMember() || Parent()->IsWeakMember()) ? "mem" : | 596 (Parent()->IsMember() || Parent()->IsWeakMember()) ? "mem" : |
594 "val"); | 597 "val"); |
595 json_->CloseObject(); | 598 json_->CloseObject(); |
596 } | 599 } |
597 | 600 |
598 void DumpField(RecordInfo* src, FieldPoint* point, const std::string& loc) { | 601 void DumpField(RecordInfo* src, FieldPoint* point, const std::string& loc) { |
599 src_ = src; | 602 src_ = src; |
600 point_ = point; | 603 point_ = point; |
601 loc_ = loc; | 604 loc_ = loc; |
602 point_->edge()->Accept(this); | 605 point_->edge()->Accept(this); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 SourceLocation spelling_location = source_manager.getSpellingLoc(loc); | 715 SourceLocation spelling_location = source_manager.getSpellingLoc(loc); |
713 PresumedLoc ploc = source_manager.getPresumedLoc(spelling_location); | 716 PresumedLoc ploc = source_manager.getPresumedLoc(spelling_location); |
714 if (ploc.isInvalid()) { | 717 if (ploc.isInvalid()) { |
715 // If we're in an invalid location, we're looking at things that aren't | 718 // If we're in an invalid location, we're looking at things that aren't |
716 // actually stated in the source. | 719 // actually stated in the source. |
717 return false; | 720 return false; |
718 } | 721 } |
719 *filename = ploc.getFilename(); | 722 *filename = ploc.getFilename(); |
720 return true; | 723 return true; |
721 } | 724 } |
OLD | NEW |