Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 421 bool IsBlacklistedInstanceMethodName(llvm::StringRef name) { | 421 bool IsBlacklistedInstanceMethodName(llvm::StringRef name) { |
| 422 static const char* kBlacklistedNames[] = { | 422 static const char* kBlacklistedNames[] = { |
| 423 // We should avoid renaming the method names listed below, because | 423 // We should avoid renaming the method names listed below, because |
| 424 // 1. They are used in templated code (e.g. in <algorithms>) | 424 // 1. They are used in templated code (e.g. in <algorithms>) |
| 425 // 2. They (begin+end) are used in range-based for syntax sugar | 425 // 2. They (begin+end) are used in range-based for syntax sugar |
| 426 // - for (auto x : foo) { ... } // <- foo.begin() will be called. | 426 // - for (auto x : foo) { ... } // <- foo.begin() will be called. |
| 427 "begin", "end", "rbegin", "rend", "lock", "unlock", "try_lock", | 427 "begin", "end", "rbegin", "rend", "lock", "unlock", "try_lock", |
| 428 | 428 |
| 429 // https://crbug.com/672902: Should not rewrite names that mimick methods | 429 // https://crbug.com/672902: Should not rewrite names that mimick methods |
| 430 // from std library. | 430 // from std library. |
| 431 "at", "back", "empty", "erase", "front", "insert", "length", "size", | 431 "at", "back", |
| 432 "clear" | |
| 433 "empty", | |
| 434 "erase", "find", "front", "insert", "length", "size", "swap", | |
|
dcheng
2017/05/08 18:56:12
We can revert this file altogether for now as well
Łukasz Anforowicz
2017/05/08 19:06:03
Done. In theory we could have kept addition of "c
| |
| 432 }; | 435 }; |
| 433 for (const auto& b : kBlacklistedNames) { | 436 for (const auto& b : kBlacklistedNames) { |
| 434 if (name == b) | 437 if (name == b) |
| 435 return true; | 438 return true; |
| 436 } | 439 } |
| 437 return false; | 440 return false; |
| 438 } | 441 } |
| 439 | 442 |
| 440 bool IsBlacklistedMethodName(llvm::StringRef name) { | 443 bool IsBlacklistedMethodName(llvm::StringRef name) { |
| 441 return IsBlacklistedFunctionName(name) || | 444 return IsBlacklistedFunctionName(name) || |
| (...skipping 1510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1952 for (const auto& r : replacements) { | 1955 for (const auto& r : replacements) { |
| 1953 std::string replacement_text = r.getReplacementText().str(); | 1956 std::string replacement_text = r.getReplacementText().str(); |
| 1954 std::replace(replacement_text.begin(), replacement_text.end(), '\n', '\0'); | 1957 std::replace(replacement_text.begin(), replacement_text.end(), '\n', '\0'); |
| 1955 llvm::outs() << "r:::" << r.getFilePath() << ":::" << r.getOffset() | 1958 llvm::outs() << "r:::" << r.getFilePath() << ":::" << r.getOffset() |
| 1956 << ":::" << r.getLength() << ":::" << replacement_text << "\n"; | 1959 << ":::" << r.getLength() << ":::" << replacement_text << "\n"; |
| 1957 } | 1960 } |
| 1958 llvm::outs() << "==== END EDITS ====\n"; | 1961 llvm::outs() << "==== END EDITS ====\n"; |
| 1959 | 1962 |
| 1960 return 0; | 1963 return 0; |
| 1961 } | 1964 } |
| OLD | NEW |