| 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |