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_.Traverse(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 21 matching lines...) Expand all Loading... |
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] == "no-realpath") { | 64 } else if (args[i] == "no-realpath") { |
65 options_.no_realpath = true; | 65 options_.no_realpath = true; |
| 66 } else if (args[i] == "check-ipc") { |
| 67 options_.check_ipc = true; |
66 } else { | 68 } else { |
67 parsed = false; | 69 parsed = false; |
68 llvm::errs() << "Unknown clang plugin argument: " << args[i] << "\n"; | 70 llvm::errs() << "Unknown clang plugin argument: " << args[i] << "\n"; |
69 } | 71 } |
70 } | 72 } |
71 | 73 |
72 return parsed; | 74 return parsed; |
73 } | 75 } |
74 | 76 |
75 } // namespace chrome_checker | 77 } // namespace chrome_checker |
76 | 78 |
77 static FrontendPluginRegistry::Add<chrome_checker::FindBadConstructsAction> X( | 79 static FrontendPluginRegistry::Add<chrome_checker::FindBadConstructsAction> X( |
78 "find-bad-constructs", | 80 "find-bad-constructs", |
79 "Finds bad C++ constructs"); | 81 "Finds bad C++ constructs"); |
OLD | NEW |