| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // This clang plugin checks various invariants of the Blink garbage | 5 // This clang plugin checks various invariants of the Blink garbage |
| 6 // collection infrastructure. | 6 // collection infrastructure. |
| 7 // | 7 // |
| 8 // Errors are described at: | 8 // Errors are described at: |
| 9 // http://www.chromium.org/developers/blink-gc-plugin-errors | 9 // http://www.chromium.org/developers/blink-gc-plugin-errors |
| 10 | 10 |
| (...skipping 1588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1599 RecordCache cache_; | 1599 RecordCache cache_; |
| 1600 JsonWriter* json_; | 1600 JsonWriter* json_; |
| 1601 }; | 1601 }; |
| 1602 | 1602 |
| 1603 class BlinkGCPluginAction : public PluginASTAction { | 1603 class BlinkGCPluginAction : public PluginASTAction { |
| 1604 public: | 1604 public: |
| 1605 BlinkGCPluginAction() {} | 1605 BlinkGCPluginAction() {} |
| 1606 | 1606 |
| 1607 protected: | 1607 protected: |
| 1608 // Overridden from PluginASTAction: | 1608 // Overridden from PluginASTAction: |
| 1609 virtual ASTConsumer* CreateASTConsumer(CompilerInstance& instance, | 1609 virtual std::unique_ptr<ASTConsumer> CreateASTConsumer( |
| 1610 llvm::StringRef ref) { | 1610 CompilerInstance& instance, |
| 1611 return new BlinkGCPluginConsumer(instance, options_); | 1611 llvm::StringRef ref) { |
| 1612 return llvm::make_unique<BlinkGCPluginConsumer>(instance, options_); |
| 1612 } | 1613 } |
| 1613 | 1614 |
| 1614 virtual bool ParseArgs(const CompilerInstance& instance, | 1615 virtual bool ParseArgs(const CompilerInstance& instance, |
| 1615 const std::vector<string>& args) { | 1616 const std::vector<string>& args) { |
| 1616 bool parsed = true; | 1617 bool parsed = true; |
| 1617 | 1618 |
| 1618 for (size_t i = 0; i < args.size() && parsed; ++i) { | 1619 for (size_t i = 0; i < args.size() && parsed; ++i) { |
| 1619 if (args[i] == "enable-oilpan") { | 1620 if (args[i] == "enable-oilpan") { |
| 1620 options_.enable_oilpan = true; | 1621 options_.enable_oilpan = true; |
| 1621 } else if (args[i] == "dump-graph") { | 1622 } else if (args[i] == "dump-graph") { |
| 1622 options_.dump_graph = true; | 1623 options_.dump_graph = true; |
| 1623 } else { | 1624 } else { |
| 1624 parsed = false; | 1625 parsed = false; |
| 1625 llvm::errs() << "Unknown blink-gc-plugin argument: " << args[i] << "\n"; | 1626 llvm::errs() << "Unknown blink-gc-plugin argument: " << args[i] << "\n"; |
| 1626 } | 1627 } |
| 1627 } | 1628 } |
| 1628 | 1629 |
| 1629 return parsed; | 1630 return parsed; |
| 1630 } | 1631 } |
| 1631 | 1632 |
| 1632 private: | 1633 private: |
| 1633 BlinkGCPluginOptions options_; | 1634 BlinkGCPluginOptions options_; |
| 1634 }; | 1635 }; |
| 1635 | 1636 |
| 1636 } // namespace | 1637 } // namespace |
| 1637 | 1638 |
| 1638 static FrontendPluginRegistry::Add<BlinkGCPluginAction> X( | 1639 static FrontendPluginRegistry::Add<BlinkGCPluginAction> X( |
| 1639 "blink-gc-plugin", | 1640 "blink-gc-plugin", |
| 1640 "Check Blink GC invariants"); | 1641 "Check Blink GC invariants"); |
| OLD | NEW |