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