| 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 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 | 637 |
| 638 // Field, variable, and enum declarations ======== | 638 // Field, variable, and enum declarations ======== |
| 639 // Given | 639 // Given |
| 640 // int x; | 640 // int x; |
| 641 // struct S { | 641 // struct S { |
| 642 // int y; | 642 // int y; |
| 643 // enum { VALUE }; | 643 // enum { VALUE }; |
| 644 // }; | 644 // }; |
| 645 // matches |x|, |y|, and |VALUE|. | 645 // matches |x|, |y|, and |VALUE|. |
| 646 auto field_decl_matcher = id("decl", fieldDecl(in_blink_namespace)); | 646 auto field_decl_matcher = id("decl", fieldDecl(in_blink_namespace)); |
| 647 auto is_type_trait_value = | 647 auto is_type_trait_value = varDecl( |
| 648 varDecl(hasName("value"), hasStaticStorageDuration(), isPublic(), | 648 hasStaticStorageDuration(), isPublic(), |
| 649 hasType(isConstQualified()), hasType(type(anyOf( | 649 anyOf(hasName("value"), hasName("Value")), |
| 650 booleanType(), enumType()))), | 650 hasType(type(anyOf(booleanType(), enumType()))), |
| 651 unless(hasAncestor(recordDecl( | 651 hasType(isConstQualified()), |
| 652 has(cxxMethodDecl(isUserProvided(), isInstanceMethod())))))); | 652 unless(hasAncestor(recordDecl( |
| 653 has(cxxMethodDecl(isUserProvided(), isInstanceMethod())))))); |
| 653 auto var_decl_matcher = | 654 auto var_decl_matcher = |
| 654 id("decl", varDecl(in_blink_namespace, unless(is_type_trait_value))); | 655 id("decl", varDecl(in_blink_namespace, unless(is_type_trait_value))); |
| 655 auto enum_member_decl_matcher = | 656 auto enum_member_decl_matcher = |
| 656 id("decl", enumConstantDecl(in_blink_namespace)); | 657 id("decl", enumConstantDecl(in_blink_namespace)); |
| 657 | 658 |
| 658 FieldDeclRewriter field_decl_rewriter(&replacements); | 659 FieldDeclRewriter field_decl_rewriter(&replacements); |
| 659 match_finder.addMatcher(field_decl_matcher, &field_decl_rewriter); | 660 match_finder.addMatcher(field_decl_matcher, &field_decl_rewriter); |
| 660 | 661 |
| 661 VarDeclRewriter var_decl_rewriter(&replacements); | 662 VarDeclRewriter var_decl_rewriter(&replacements); |
| 662 match_finder.addMatcher(var_decl_matcher, &var_decl_rewriter); | 663 match_finder.addMatcher(var_decl_matcher, &var_decl_rewriter); |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 932 for (const auto& r : replacements) { | 933 for (const auto& r : replacements) { |
| 933 std::string replacement_text = r.getReplacementText().str(); | 934 std::string replacement_text = r.getReplacementText().str(); |
| 934 std::replace(replacement_text.begin(), replacement_text.end(), '\n', '\0'); | 935 std::replace(replacement_text.begin(), replacement_text.end(), '\n', '\0'); |
| 935 llvm::outs() << "r:::" << r.getFilePath() << ":::" << r.getOffset() | 936 llvm::outs() << "r:::" << r.getFilePath() << ":::" << r.getOffset() |
| 936 << ":::" << r.getLength() << ":::" << replacement_text << "\n"; | 937 << ":::" << r.getLength() << ":::" << replacement_text << "\n"; |
| 937 } | 938 } |
| 938 llvm::outs() << "==== END EDITS ====\n"; | 939 llvm::outs() << "==== END EDITS ====\n"; |
| 939 | 940 |
| 940 return 0; | 941 return 0; |
| 941 } | 942 } |
| OLD | NEW |