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

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

Issue 2595213002: Tweaking lists of method names to treat in a special way. (Closed)
Patch Set: Created 3 years, 12 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 return false; 213 return false;
214 } 214 }
215 215
216 bool IsBlacklistedFunction(const clang::FunctionDecl& decl) { 216 bool IsBlacklistedFunction(const clang::FunctionDecl& decl) {
217 // swap() functions should match the signature of std::swap for ADL tricks. 217 // swap() functions should match the signature of std::swap for ADL tricks.
218 return decl.getName() == "swap"; 218 return decl.getName() == "swap";
219 } 219 }
220 220
221 bool IsBlacklistedMethodName(llvm::StringRef name) { 221 bool IsBlacklistedMethodName(llvm::StringRef name) {
222 static const char* kBlacklistedNames[] = { 222 static const char* kBlacklistedNames[] = {
223 "hash",
223 "lock", "unlock", "try_lock", 224 "lock", "unlock", "try_lock",
224 "begin", "end", "rbegin", "rend", 225 "begin", "end", "rbegin", "rend",
225 }; 226 };
226 for (const auto& b : kBlacklistedNames) { 227 for (const auto& b : kBlacklistedNames) {
227 if (name == b) 228 if (name == b)
228 return true; 229 return true;
229 } 230 }
230 return false; 231 return false;
231 } 232 }
232 233
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 "color", 343 "color",
343 "counterDirectives", 344 "counterDirectives",
344 "document", 345 "document",
345 "emptyChromeClient", 346 "emptyChromeClient",
346 "emptyEditorClient", 347 "emptyEditorClient",
347 "emptySpellCheckerClient", 348 "emptySpellCheckerClient",
348 "entryType", 349 "entryType",
349 "error", 350 "error",
350 "fileUtilities", 351 "fileUtilities",
351 "font", 352 "font",
353 "frameBlameContext",
352 "iconURL", 354 "iconURL",
353 "inputMethodController", 355 "inputMethodController",
354 "inputType", 356 "inputType",
355 "layout", 357 "layout",
356 "layoutBlock", 358 "layoutBlock",
357 "layoutSize", 359 "layoutSize",
358 "length", 360 "length",
359 "lineCap", 361 "lineCap",
360 "lineJoin", 362 "lineJoin",
361 "matchedProperties", 363 "matchedProperties",
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after
1323 for (const auto& r : replacements) { 1325 for (const auto& r : replacements) {
1324 std::string replacement_text = r.getReplacementText().str(); 1326 std::string replacement_text = r.getReplacementText().str();
1325 std::replace(replacement_text.begin(), replacement_text.end(), '\n', '\0'); 1327 std::replace(replacement_text.begin(), replacement_text.end(), '\n', '\0');
1326 llvm::outs() << "r:::" << r.getFilePath() << ":::" << r.getOffset() 1328 llvm::outs() << "r:::" << r.getFilePath() << ":::" << r.getOffset()
1327 << ":::" << r.getLength() << ":::" << replacement_text << "\n"; 1329 << ":::" << r.getLength() << ":::" << replacement_text << "\n";
1328 } 1330 }
1329 llvm::outs() << "==== END EDITS ====\n"; 1331 llvm::outs() << "==== END EDITS ====\n";
1330 1332
1331 return 0; 1333 return 0;
1332 } 1334 }
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