Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: tools/clang/plugins/FindBadConstructs.cpp

Issue 10698147: clang: Add missing 'virtual' keyword to some overridden functions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 file defines a bunch of recurring problems in the Chromium C++ code. 5 // This file defines a bunch of recurring problems in the Chromium C++ code.
6 // 6 //
7 // Checks that are implemented: 7 // Checks that are implemented:
8 // - Constructors/Destructors should not be inlined if they are of a complex 8 // - Constructors/Destructors should not be inlined if they are of a complex
9 // class type. 9 // class type.
10 // - Missing "virtual" keywords on methods that should be virtual. 10 // - Missing "virtual" keywords on methods that should be virtual.
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 }; 392 };
393 393
394 class FindBadConstructsAction : public PluginASTAction { 394 class FindBadConstructsAction : public PluginASTAction {
395 public: 395 public:
396 FindBadConstructsAction() 396 FindBadConstructsAction()
397 : check_refcounted_dtors_(true), 397 : check_refcounted_dtors_(true),
398 check_virtuals_in_implementations_(true) { 398 check_virtuals_in_implementations_(true) {
399 } 399 }
400 400
401 protected: 401 protected:
402 ASTConsumer* CreateASTConsumer(CompilerInstance &CI, llvm::StringRef ref) { 402 // Overridden from PluginASTAction:
403 virtual ASTConsumer* CreateASTConsumer(CompilerInstance& instance,
404 llvm::StringRef ref) {
403 return new FindBadConstructsConsumer( 405 return new FindBadConstructsConsumer(
404 CI, check_refcounted_dtors_, check_virtuals_in_implementations_); 406 instance, check_refcounted_dtors_, check_virtuals_in_implementations_);
405 } 407 }
406 408
407 bool ParseArgs(const CompilerInstance &CI, 409 virtual bool ParseArgs(const CompilerInstance& instance,
408 const std::vector<std::string>& args) { 410 const std::vector<std::string>& args) {
409 bool parsed = true; 411 bool parsed = true;
410 412
411 for (size_t i = 0; i < args.size() && parsed; ++i) { 413 for (size_t i = 0; i < args.size() && parsed; ++i) {
412 if (args[i] == "skip-refcounted-dtors") { 414 if (args[i] == "skip-refcounted-dtors") {
413 check_refcounted_dtors_ = false; 415 check_refcounted_dtors_ = false;
414 } else if (args[i] == "skip-virtuals-in-implementations") { 416 } else if (args[i] == "skip-virtuals-in-implementations") {
415 check_virtuals_in_implementations_ = false; 417 check_virtuals_in_implementations_ = false;
416 } else { 418 } else {
417 parsed = false; 419 parsed = false;
418 llvm::errs() << "Unknown argument: " << args[i] << "\n"; 420 llvm::errs() << "Unknown argument: " << args[i] << "\n";
419 } 421 }
420 } 422 }
421 423
422 return parsed; 424 return parsed;
423 } 425 }
424 426
425 private: 427 private:
426 bool check_refcounted_dtors_; 428 bool check_refcounted_dtors_;
427 bool check_virtuals_in_implementations_; 429 bool check_virtuals_in_implementations_;
428 }; 430 };
429 431
430 } // namespace 432 } // namespace
431 433
432 static FrontendPluginRegistry::Add<FindBadConstructsAction> 434 static FrontendPluginRegistry::Add<FindBadConstructsAction>
433 X("find-bad-constructs", "Finds bad C++ constructs"); 435 X("find-bad-constructs", "Finds bad C++ constructs");
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698