| 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 1733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1744 RecordCache cache_; | 1744 RecordCache cache_; |
| 1745 JsonWriter* json_; | 1745 JsonWriter* json_; |
| 1746 }; | 1746 }; |
| 1747 | 1747 |
| 1748 class BlinkGCPluginAction : public PluginASTAction { | 1748 class BlinkGCPluginAction : public PluginASTAction { |
| 1749 public: | 1749 public: |
| 1750 BlinkGCPluginAction() {} | 1750 BlinkGCPluginAction() {} |
| 1751 | 1751 |
| 1752 protected: | 1752 protected: |
| 1753 // Overridden from PluginASTAction: | 1753 // Overridden from PluginASTAction: |
| 1754 virtual ASTConsumer* CreateASTConsumer(CompilerInstance& instance, | 1754 virtual std::unique_ptr<ASTConsumer> CreateASTConsumer( |
| 1755 llvm::StringRef ref) { | 1755 CompilerInstance& instance, |
| 1756 return new BlinkGCPluginConsumer(instance, options_); | 1756 llvm::StringRef ref) { |
| 1757 return llvm::make_unique<BlinkGCPluginConsumer>(instance, options_); |
| 1757 } | 1758 } |
| 1758 | 1759 |
| 1759 virtual bool ParseArgs(const CompilerInstance& instance, | 1760 virtual bool ParseArgs(const CompilerInstance& instance, |
| 1760 const std::vector<string>& args) { | 1761 const std::vector<string>& args) { |
| 1761 bool parsed = true; | 1762 bool parsed = true; |
| 1762 | 1763 |
| 1763 for (size_t i = 0; i < args.size() && parsed; ++i) { | 1764 for (size_t i = 0; i < args.size() && parsed; ++i) { |
| 1764 if (args[i] == "enable-oilpan") { | 1765 if (args[i] == "enable-oilpan") { |
| 1765 options_.enable_oilpan = true; | 1766 options_.enable_oilpan = true; |
| 1766 } else if (args[i] == "dump-graph") { | 1767 } else if (args[i] == "dump-graph") { |
| 1767 options_.dump_graph = true; | 1768 options_.dump_graph = true; |
| 1768 } else { | 1769 } else { |
| 1769 parsed = false; | 1770 parsed = false; |
| 1770 llvm::errs() << "Unknown blink-gc-plugin argument: " << args[i] << "\n"; | 1771 llvm::errs() << "Unknown blink-gc-plugin argument: " << args[i] << "\n"; |
| 1771 } | 1772 } |
| 1772 } | 1773 } |
| 1773 | 1774 |
| 1774 return parsed; | 1775 return parsed; |
| 1775 } | 1776 } |
| 1776 | 1777 |
| 1777 private: | 1778 private: |
| 1778 BlinkGCPluginOptions options_; | 1779 BlinkGCPluginOptions options_; |
| 1779 }; | 1780 }; |
| 1780 | 1781 |
| 1781 } // namespace | 1782 } // namespace |
| 1782 | 1783 |
| 1783 static FrontendPluginRegistry::Add<BlinkGCPluginAction> X( | 1784 static FrontendPluginRegistry::Add<BlinkGCPluginAction> X( |
| 1784 "blink-gc-plugin", | 1785 "blink-gc-plugin", |
| 1785 "Check Blink GC invariants"); | 1786 "Check Blink GC invariants"); |
| OLD | NEW |