| 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 11 matching lines...) Expand all Loading... |
| 22 BlinkGCPluginAction() {} | 22 BlinkGCPluginAction() {} |
| 23 | 23 |
| 24 protected: | 24 protected: |
| 25 // Overridden from PluginASTAction: | 25 // Overridden from PluginASTAction: |
| 26 virtual std::unique_ptr<ASTConsumer> CreateASTConsumer( | 26 virtual std::unique_ptr<ASTConsumer> CreateASTConsumer( |
| 27 CompilerInstance& instance, | 27 CompilerInstance& instance, |
| 28 llvm::StringRef ref) { | 28 llvm::StringRef ref) { |
| 29 return llvm::make_unique<BlinkGCPluginConsumer>(instance, options_); | 29 return llvm::make_unique<BlinkGCPluginConsumer>(instance, options_); |
| 30 } | 30 } |
| 31 | 31 |
| 32 virtual bool ParseArgs(const CompilerInstance& instance, | 32 virtual bool ParseArgs(const CompilerInstance&, |
| 33 const std::vector<std::string>& args) { | 33 const std::vector<std::string>& args) { |
| 34 bool parsed = true; | 34 for (const auto& arg : args) { |
| 35 | 35 if (arg == "dump-graph") { |
| 36 for (size_t i = 0; i < args.size() && parsed; ++i) { | |
| 37 // TODO(sof): remove this case once a version of the GC plugin | |
| 38 // has rolled which has enable-oilpan-always baked in _and_ | |
| 39 // Blink no longer passes in the option (cf. Source/config.gyp) | |
| 40 if (args[i] == "enable-oilpan") | |
| 41 continue; | |
| 42 // TODO(sof): same for warn-raw-ptr | |
| 43 if (args[i] == "warn-raw-ptr") | |
| 44 continue; | |
| 45 if (args[i] == "dump-graph") { | |
| 46 options_.dump_graph = true; | 36 options_.dump_graph = true; |
| 47 } else if (args[i] == "warn-unneeded-finalizer") { | 37 } else if (arg == "warn-unneeded-finalizer") { |
| 48 options_.warn_unneeded_finalizer = true; | 38 options_.warn_unneeded_finalizer = true; |
| 49 } else { | 39 } else { |
| 50 parsed = false; | 40 llvm::errs() << "Unknown blink-gc-plugin argument: " << arg << "\n"; |
| 51 llvm::errs() << "Unknown blink-gc-plugin argument: " << args[i] << "\n"; | 41 return false; |
| 52 } | 42 } |
| 53 } | 43 } |
| 54 | 44 return true; |
| 55 return parsed; | |
| 56 } | 45 } |
| 57 | 46 |
| 58 private: | 47 private: |
| 59 BlinkGCPluginOptions options_; | 48 BlinkGCPluginOptions options_; |
| 60 }; | 49 }; |
| 61 | 50 |
| 62 static FrontendPluginRegistry::Add<BlinkGCPluginAction> X( | 51 static FrontendPluginRegistry::Add<BlinkGCPluginAction> X( |
| 63 "blink-gc-plugin", | 52 "blink-gc-plugin", |
| 64 "Check Blink GC invariants"); | 53 "Check Blink GC invariants"); |
| OLD | NEW |