OLD | NEW |
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 #include "FindBadConstructsAction.h" | 5 #include "FindBadConstructsAction.h" |
6 | 6 |
7 #include "clang/AST/ASTConsumer.h" | 7 #include "clang/AST/ASTConsumer.h" |
8 #include "clang/Frontend/FrontendPluginRegistry.h" | 8 #include "clang/Frontend/FrontendPluginRegistry.h" |
9 | 9 |
10 #include "FindBadConstructsConsumer.h" | 10 #include "FindBadConstructsConsumer.h" |
11 | 11 |
12 using namespace clang; | 12 using namespace clang; |
13 | 13 |
14 namespace chrome_checker { | 14 namespace chrome_checker { |
15 | 15 |
16 namespace { | 16 namespace { |
17 | 17 |
18 class PluginConsumer : public ASTConsumer { | 18 class PluginConsumer : public ASTConsumer { |
19 public: | 19 public: |
20 PluginConsumer(CompilerInstance* instance, const Options& options) | 20 PluginConsumer(CompilerInstance* instance, const Options& options) |
21 : visitor_(*instance, options) {} | 21 : visitor_(*instance, options) {} |
22 | 22 |
23 void HandleTranslationUnit(clang::ASTContext& context) override { | 23 void HandleTranslationUnit(clang::ASTContext& context) override { |
24 visitor_.TraverseDecl(context.getTranslationUnitDecl()); | 24 visitor_.Visit(context); |
25 } | 25 } |
26 | 26 |
27 private: | 27 private: |
28 FindBadConstructsConsumer visitor_; | 28 FindBadConstructsConsumer visitor_; |
29 }; | 29 }; |
30 | 30 |
31 } // namespace | 31 } // namespace |
32 | 32 |
33 FindBadConstructsAction::FindBadConstructsAction() { | 33 FindBadConstructsAction::FindBadConstructsAction() { |
34 } | 34 } |
(...skipping 19 matching lines...) Expand all Loading... |
54 } else if (args[i] == "check-enum-last-value") { | 54 } else if (args[i] == "check-enum-last-value") { |
55 // TODO(tsepez): Enable this by default once http://crbug.com/356815 | 55 // TODO(tsepez): Enable this by default once http://crbug.com/356815 |
56 // and http://crbug.com/356816 are fixed. | 56 // and http://crbug.com/356816 are fixed. |
57 options_.check_enum_last_value = true; | 57 options_.check_enum_last_value = true; |
58 } else if (args[i] == "check-templates") { | 58 } else if (args[i] == "check-templates") { |
59 options_.check_templates = true; | 59 options_.check_templates = true; |
60 } else if (args[i] == "follow-macro-expansion") { | 60 } else if (args[i] == "follow-macro-expansion") { |
61 options_.follow_macro_expansion = true; | 61 options_.follow_macro_expansion = true; |
62 } else if (args[i] == "check-implicit-copy-ctors") { | 62 } else if (args[i] == "check-implicit-copy-ctors") { |
63 options_.check_implicit_copy_ctors = true; | 63 options_.check_implicit_copy_ctors = true; |
| 64 } else if (args[i] == "check-ipc") { |
| 65 options_.check_ipc = true; |
64 } else { | 66 } else { |
65 parsed = false; | 67 parsed = false; |
66 llvm::errs() << "Unknown clang plugin argument: " << args[i] << "\n"; | 68 llvm::errs() << "Unknown clang plugin argument: " << args[i] << "\n"; |
67 } | 69 } |
68 } | 70 } |
69 | 71 |
70 return parsed; | 72 return parsed; |
71 } | 73 } |
72 | 74 |
73 } // namespace chrome_checker | 75 } // namespace chrome_checker |
74 | 76 |
75 static FrontendPluginRegistry::Add<chrome_checker::FindBadConstructsAction> X( | 77 static FrontendPluginRegistry::Add<chrome_checker::FindBadConstructsAction> X( |
76 "find-bad-constructs", | 78 "find-bad-constructs", |
77 "Finds bad C++ constructs"); | 79 "Finds bad C++ constructs"); |
OLD | NEW |