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

Side by Side Diff: tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp

Issue 2314853002: Blacklist renaming of traceImpl method for compatibility with Oilpan plugin. (Closed)
Patch Set: Created 4 years, 3 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 | 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 // Changes Blink-style names to Chrome-style names. Currently transforms: 5 // Changes Blink-style names to Chrome-style names. Currently transforms:
6 // fields: 6 // fields:
7 // int m_operationCount => int operation_count_ 7 // int m_operationCount => int operation_count_
8 // variables (including parameters): 8 // variables (including parameters):
9 // int mySuperVariable => int my_super_variable 9 // int mySuperVariable => int my_super_variable
10 // constants: 10 // constants:
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 return decl.getName() == "swap"; 175 return decl.getName() == "swap";
176 } 176 }
177 177
178 bool IsBlacklistedMethod(const clang::CXXMethodDecl& decl) { 178 bool IsBlacklistedMethod(const clang::CXXMethodDecl& decl) {
179 if (decl.isStatic()) 179 if (decl.isStatic())
180 return false; 180 return false;
181 181
182 clang::StringRef name = decl.getName(); 182 clang::StringRef name = decl.getName();
183 183
184 // These methods should never be renamed. 184 // These methods should never be renamed.
185 static const char* kBlacklistMethods[] = {"trace", "lock", "unlock", 185 static const char* kBlacklistMethods[] = {"trace", "traceImpl", "lock",
186 "try_lock"}; 186 "unlock", "try_lock"};
187 for (const auto& b : kBlacklistMethods) { 187 for (const auto& b : kBlacklistMethods) {
188 if (name == b) 188 if (name == b)
189 return true; 189 return true;
190 } 190 }
191 191
192 // Iterator methods shouldn't be renamed to work with stl and range-for 192 // Iterator methods shouldn't be renamed to work with stl and range-for
193 // loops. 193 // loops.
194 std::string ret_type = decl.getReturnType().getAsString(); 194 std::string ret_type = decl.getReturnType().getAsString();
195 if (ret_type.find("iterator") != std::string::npos || 195 if (ret_type.find("iterator") != std::string::npos ||
196 ret_type.find("Iterator") != std::string::npos) { 196 ret_type.find("Iterator") != std::string::npos) {
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 for (const auto& r : replacements) { 932 for (const auto& r : replacements) {
933 std::string replacement_text = r.getReplacementText().str(); 933 std::string replacement_text = r.getReplacementText().str();
934 std::replace(replacement_text.begin(), replacement_text.end(), '\n', '\0'); 934 std::replace(replacement_text.begin(), replacement_text.end(), '\n', '\0');
935 llvm::outs() << "r:::" << r.getFilePath() << ":::" << r.getOffset() 935 llvm::outs() << "r:::" << r.getFilePath() << ":::" << r.getOffset()
936 << ":::" << r.getLength() << ":::" << replacement_text << "\n"; 936 << ":::" << r.getLength() << ":::" << replacement_text << "\n";
937 } 937 }
938 llvm::outs() << "==== END EDITS ====\n"; 938 llvm::outs() << "==== END EDITS ====\n";
939 939
940 return 0; 940 return 0;
941 } 941 }
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