| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 // Handles various rewrites for base::ListValue::Append(). | 5 // Handles various rewrites for base::ListValue::Append(). |
| 6 | 6 |
| 7 #ifndef TOOLS_CLANG_VALUE_CLEANUP_LIST_VALUE_REWRITER_H_ | 7 #ifndef TOOLS_CLANG_VALUE_CLEANUP_LIST_VALUE_REWRITER_H_ |
| 8 #define TOOLS_CLANG_VALUE_CLEANUP_LIST_VALUE_REWRITER_H_ | 8 #define TOOLS_CLANG_VALUE_CLEANUP_LIST_VALUE_REWRITER_H_ |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <unordered_set> |
| 11 | 12 |
| 12 #include "clang/ASTMatchers/ASTMatchFinder.h" | 13 #include "clang/ASTMatchers/ASTMatchFinder.h" |
| 13 #include "clang/Tooling/Refactoring.h" | 14 #include "clang/Tooling/Refactoring.h" |
| 14 | 15 |
| 15 class ListValueRewriter { | 16 class ListValueRewriter { |
| 16 public: | 17 public: |
| 17 explicit ListValueRewriter(clang::tooling::Replacements* replacements); | 18 explicit ListValueRewriter(clang::tooling::Replacements* replacements); |
| 18 | 19 |
| 19 void RegisterMatchers(clang::ast_matchers::MatchFinder* match_finder); | 20 void RegisterMatchers(clang::ast_matchers::MatchFinder* match_finder); |
| 20 | 21 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 66 |
| 66 class AppendReleasedUniquePtrCallback | 67 class AppendReleasedUniquePtrCallback |
| 67 : public clang::ast_matchers::MatchFinder::MatchCallback { | 68 : public clang::ast_matchers::MatchFinder::MatchCallback { |
| 68 public: | 69 public: |
| 69 explicit AppendReleasedUniquePtrCallback( | 70 explicit AppendReleasedUniquePtrCallback( |
| 70 clang::tooling::Replacements* replacements); | 71 clang::tooling::Replacements* replacements); |
| 71 | 72 |
| 72 void run( | 73 void run( |
| 73 const clang::ast_matchers::MatchFinder::MatchResult& result) override; | 74 const clang::ast_matchers::MatchFinder::MatchResult& result) override; |
| 74 | 75 |
| 75 protected: | 76 private: |
| 76 clang::tooling::Replacements* const replacements_; | 77 clang::tooling::Replacements* const replacements_; |
| 77 }; | 78 }; |
| 78 | 79 |
| 80 class AppendRawPtrCallback |
| 81 : public clang::ast_matchers::MatchFinder::MatchCallback { |
| 82 public: |
| 83 explicit AppendRawPtrCallback(clang::tooling::Replacements* replacements); |
| 84 |
| 85 void run( |
| 86 const clang::ast_matchers::MatchFinder::MatchResult& result) override; |
| 87 |
| 88 private: |
| 89 clang::tooling::Replacements* const replacements_; |
| 90 std::unordered_set<const clang::VarDecl*> visited_; |
| 91 }; |
| 92 |
| 79 AppendBooleanCallback append_boolean_callback_; | 93 AppendBooleanCallback append_boolean_callback_; |
| 80 AppendIntegerCallback append_integer_callback_; | 94 AppendIntegerCallback append_integer_callback_; |
| 81 AppendDoubleCallback append_double_callback_; | 95 AppendDoubleCallback append_double_callback_; |
| 82 AppendStringCallback append_string_callback_; | 96 AppendStringCallback append_string_callback_; |
| 83 AppendReleasedUniquePtrCallback append_released_unique_ptr_callback_; | 97 AppendReleasedUniquePtrCallback append_released_unique_ptr_callback_; |
| 98 AppendRawPtrCallback append_raw_ptr_callback_; |
| 84 }; | 99 }; |
| 85 | 100 |
| 86 #endif // TOOLS_CLANG_VALUE_CLEANUP_LIST_VALUE_REWRITER_H_ | 101 #endif // TOOLS_CLANG_VALUE_CLEANUP_LIST_VALUE_REWRITER_H_ |
| OLD | NEW |