| 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 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1050 // Given | 1050 // Given |
| 1051 // int x; | 1051 // int x; |
| 1052 // struct S { | 1052 // struct S { |
| 1053 // int y; | 1053 // int y; |
| 1054 // enum { VALUE }; | 1054 // enum { VALUE }; |
| 1055 // }; | 1055 // }; |
| 1056 // matches |x|, |y|, and |VALUE|. | 1056 // matches |x|, |y|, and |VALUE|. |
| 1057 auto field_decl_matcher = id("decl", fieldDecl(in_blink_namespace)); | 1057 auto field_decl_matcher = id("decl", fieldDecl(in_blink_namespace)); |
| 1058 auto is_type_trait_value = | 1058 auto is_type_trait_value = |
| 1059 varDecl(hasName("value"), hasStaticStorageDuration(), isPublic(), | 1059 varDecl(hasName("value"), hasStaticStorageDuration(), isPublic(), |
| 1060 hasType(isConstQualified()), hasType(type(anyOf( | 1060 hasType(isConstQualified()), |
| 1061 booleanType(), enumType()))), | 1061 hasType(type(anyOf(builtinType(), enumType()))), |
| 1062 unless(hasAncestor(recordDecl( | 1062 unless(hasAncestor(recordDecl( |
| 1063 has(cxxMethodDecl(isUserProvided(), isInstanceMethod())))))); | 1063 has(cxxMethodDecl(isUserProvided(), isInstanceMethod())))))); |
| 1064 auto var_decl_matcher = | 1064 auto var_decl_matcher = |
| 1065 id("decl", varDecl(in_blink_namespace, unless(is_type_trait_value))); | 1065 id("decl", varDecl(in_blink_namespace, unless(is_type_trait_value))); |
| 1066 auto enum_member_decl_matcher = | 1066 auto enum_member_decl_matcher = |
| 1067 id("decl", enumConstantDecl(in_blink_namespace)); | 1067 id("decl", enumConstantDecl(in_blink_namespace)); |
| 1068 | 1068 |
| 1069 FieldDeclRewriter field_decl_rewriter(&replacements); | 1069 FieldDeclRewriter field_decl_rewriter(&replacements); |
| 1070 match_finder.addMatcher(field_decl_matcher, &field_decl_rewriter); | 1070 match_finder.addMatcher(field_decl_matcher, &field_decl_rewriter); |
| 1071 | 1071 |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1392 for (const auto& r : replacements) { | 1392 for (const auto& r : replacements) { |
| 1393 std::string replacement_text = r.getReplacementText().str(); | 1393 std::string replacement_text = r.getReplacementText().str(); |
| 1394 std::replace(replacement_text.begin(), replacement_text.end(), '\n', '\0'); | 1394 std::replace(replacement_text.begin(), replacement_text.end(), '\n', '\0'); |
| 1395 llvm::outs() << "r:::" << r.getFilePath() << ":::" << r.getOffset() | 1395 llvm::outs() << "r:::" << r.getFilePath() << ":::" << r.getOffset() |
| 1396 << ":::" << r.getLength() << ":::" << replacement_text << "\n"; | 1396 << ":::" << r.getLength() << ":::" << replacement_text << "\n"; |
| 1397 } | 1397 } |
| 1398 llvm::outs() << "==== END EDITS ====\n"; | 1398 llvm::outs() << "==== END EDITS ====\n"; |
| 1399 | 1399 |
| 1400 return 0; | 1400 return 0; |
| 1401 } | 1401 } |
| OLD | NEW |