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

Side by Side Diff: tools/clang/value_cleanup/ListValueRewriter.h

Issue 2056573002: value_cleanup: fixup ListValue::Append() calls that already have a unique_ptr to use. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More tests Created 4 years, 6 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
« no previous file with comments | « no previous file | tools/clang/value_cleanup/ListValueRewriter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // Performs simple cleanups of base::ListValue API: 5 // Handles various rewrites for base::ListValue::Append().
6 // - base::ListValue::Append(new base::FundamentalValue(bool))
7 // => base::ListValue::AppendBoolean(...)
8 // - base::ListValue::Append(new base::FundamentalValue(int))
9 // => base::ListValue::AppendInteger(...)
10 // - base::ListValue::Append(new base::FundamentalValue(double))
11 // => base::ListValue::AppendDouble(...)
12 // - base::ListValue::Append(new base::StringValue(...))
13 // => base::ListValue::AppendString(...)
14 6
15 #ifndef TOOLS_CLANG_VALUE_CLEANUP_LIST_VALUE_REWRITER_H_ 7 #ifndef TOOLS_CLANG_VALUE_CLEANUP_LIST_VALUE_REWRITER_H_
16 #define TOOLS_CLANG_VALUE_CLEANUP_LIST_VALUE_REWRITER_H_ 8 #define TOOLS_CLANG_VALUE_CLEANUP_LIST_VALUE_REWRITER_H_
17 9
18 #include <memory> 10 #include <memory>
19 11
20 #include "clang/ASTMatchers/ASTMatchFinder.h" 12 #include "clang/ASTMatchers/ASTMatchFinder.h"
21 #include "clang/Tooling/Refactoring.h" 13 #include "clang/Tooling/Refactoring.h"
22 14
23 class ListValueRewriter { 15 class ListValueRewriter {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 }; 56 };
65 57
66 class AppendStringCallback : public AppendCallback { 58 class AppendStringCallback : public AppendCallback {
67 public: 59 public:
68 explicit AppendStringCallback(clang::tooling::Replacements* replacements); 60 explicit AppendStringCallback(clang::tooling::Replacements* replacements);
69 61
70 void run( 62 void run(
71 const clang::ast_matchers::MatchFinder::MatchResult& result) override; 63 const clang::ast_matchers::MatchFinder::MatchResult& result) override;
72 }; 64 };
73 65
66 class AppendReleasedUniquePtrCallback
67 : public clang::ast_matchers::MatchFinder::MatchCallback {
68 public:
69 explicit AppendReleasedUniquePtrCallback(
70 clang::tooling::Replacements* replacements);
71
72 void run(
73 const clang::ast_matchers::MatchFinder::MatchResult& result) override;
74
75 protected:
76 clang::tooling::Replacements* const replacements_;
77 };
78
74 AppendBooleanCallback append_boolean_callback_; 79 AppendBooleanCallback append_boolean_callback_;
75 AppendIntegerCallback append_integer_callback_; 80 AppendIntegerCallback append_integer_callback_;
76 AppendDoubleCallback append_double_callback_; 81 AppendDoubleCallback append_double_callback_;
77 AppendStringCallback append_string_callback_; 82 AppendStringCallback append_string_callback_;
83 AppendReleasedUniquePtrCallback append_released_unique_ptr_callback_;
78 }; 84 };
79 85
80 #endif // TOOLS_CLANG_VALUE_CLEANUP_LIST_VALUE_REWRITER_H_ 86 #endif // TOOLS_CLANG_VALUE_CLEANUP_LIST_VALUE_REWRITER_H_
OLDNEW
« no previous file with comments | « no previous file | tools/clang/value_cleanup/ListValueRewriter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698