| 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 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 | 652 |
| 653 AST_MATCHER_P(clang::QualType, hasString, std::string, ExpectedString) { | 653 AST_MATCHER_P(clang::QualType, hasString, std::string, ExpectedString) { |
| 654 return ExpectedString == Node.getAsString(); | 654 return ExpectedString == Node.getAsString(); |
| 655 } | 655 } |
| 656 | 656 |
| 657 bool ShouldPrefixFunctionName(const std::string& old_method_name) { | 657 bool ShouldPrefixFunctionName(const std::string& old_method_name) { |
| 658 // Functions that are named similarily to a type - they should be prefixed | 658 // Functions that are named similarily to a type - they should be prefixed |
| 659 // with a "Get" prefix. | 659 // with a "Get" prefix. |
| 660 static const char* kConflictingMethods[] = { | 660 static const char* kConflictingMethods[] = { |
| 661 "animationWorklet", | 661 "animationWorklet", |
| 662 "attrNodeList", |
| 662 "audioWorklet", | 663 "audioWorklet", |
| 663 "binaryType", | 664 "binaryType", |
| 664 "blob", | 665 "blob", |
| 665 "channelCountMode", | 666 "channelCountMode", |
| 666 "color", | 667 "color", |
| 667 "compositorElementId", | 668 "compositorElementId", |
| 669 "constructionStack", |
| 668 "counterDirectives", | 670 "counterDirectives", |
| 671 "counterMaps" |
| 669 "document", | 672 "document", |
| 670 "element", | 673 "element", |
| 671 "emptyChromeClient", | 674 "emptyChromeClient", |
| 672 "emptyEditorClient", | 675 "emptyEditorClient", |
| 673 "emptySpellCheckerClient", | 676 "emptySpellCheckerClient", |
| 674 "entryType", | 677 "entryType", |
| 675 "error", | 678 "error", |
| 676 "fileUtilities", | 679 "fileUtilities", |
| 677 "font", | 680 "font", |
| 678 "frame", | 681 "frame", |
| 679 "frameBlameContext", | 682 "frameBlameContext", |
| 680 "frontend", | 683 "frontend", |
| 681 "gridCell", | 684 "gridCell", |
| 685 "harfBuzzFontCache", |
| 682 "hash", | 686 "hash", |
| 683 "heapObjectHeader", | 687 "heapObjectHeader", |
| 684 "iconURL", | 688 "iconURL", |
| 685 "image", | 689 "image", |
| 690 "infoMap", |
| 686 "inputMethodController", | 691 "inputMethodController", |
| 687 "inputType", | 692 "inputType", |
| 688 "interpolationTypes", | 693 "interpolationTypes", |
| 694 "intervalArena", |
| 689 "layout", | 695 "layout", |
| 690 "layoutBlock", | 696 "layoutBlock", |
| 691 "layoutObject", | 697 "layoutObject", |
| 692 "layoutSize", | 698 "layoutSize", |
| 693 "lineCap", | 699 "lineCap", |
| 694 "lineEndings", | 700 "lineEndings", |
| 695 "lineJoin", | 701 "lineJoin", |
| 696 "listItems", | 702 "listItems", |
| 697 "matchedProperties", | 703 "matchedProperties", |
| 698 "midpointState", | 704 "midpointState", |
| 699 "modifiers", | 705 "modifiers", |
| 700 "mouseEvent", | 706 "mouseEvent", |
| 701 "name", | 707 "name", |
| 702 "navigationType", | 708 "navigationType", |
| 703 "node", | 709 "node", |
| 704 "notificationManager", | 710 "notificationManager", |
| 711 "originAccessMap", |
| 705 "outcome", | 712 "outcome", |
| 706 "pagePopup", | 713 "pagePopup", |
| 707 "paintWorklet", | 714 "paintWorklet", |
| 708 "path", | 715 "path", |
| 709 "position", | 716 "position", |
| 717 "presentationAttributeCache", |
| 710 "processingInstruction", | 718 "processingInstruction", |
| 711 "readyState", | 719 "readyState", |
| 712 "relList", | 720 "relList", |
| 713 "referrer", | 721 "referrer", |
| 714 "referrerPolicy", | 722 "referrerPolicy", |
| 715 "resource", | 723 "resource", |
| 716 "response", | 724 "response", |
| 717 "restrictedKeyMap", | 725 "restrictedKeyMap", |
| 718 "sandboxSupport", | 726 "sandboxSupport", |
| 719 "screenInfo", | 727 "screenInfo", |
| 720 "screenOrientationController", | 728 "screenOrientationController", |
| 721 "scrollAnimator", | 729 "scrollAnimator", |
| 722 "selectionInDOMTree", | 730 "selectionInDOMTree", |
| 723 "selectionInFlatTree", | 731 "selectionInFlatTree", |
| 732 "selectionVisualRectMap", |
| 724 "settings", | 733 "settings", |
| 725 "signalingState", | 734 "signalingState", |
| 726 "snapshotById", | 735 "snapshotById", |
| 727 "state", | 736 "state", |
| 728 "string", | 737 "string", |
| 738 "styleSharingList", |
| 729 "styleSheet", | 739 "styleSheet", |
| 730 "supplementable", | 740 "supplementable", |
| 731 "text", | 741 "text", |
| 732 "textAlign", | 742 "textAlign", |
| 733 "textBaseline", | 743 "textBaseline", |
| 734 "theme", | 744 "theme", |
| 735 "thread", | 745 "thread", |
| 736 "timing", | 746 "timing", |
| 737 "topLevelBlameContext", | 747 "topLevelBlameContext", |
| 738 "type", | 748 "type", |
| 739 "vector", | 749 "vector", |
| 740 "visibleSelection", | 750 "visibleSelection", |
| 741 "visibleSelectionInFlatTree", | 751 "visibleSelectionInFlatTree", |
| 752 "weakHeapObjectSet", |
| 742 "webFrame", | 753 "webFrame", |
| 743 "widget", | 754 "widget", |
| 744 "wordBoundaries", | 755 "wordBoundaries", |
| 745 "wrapperTypeInfo", | 756 "worldMap", |
| 757 "wrapperTypeInfo" |
| 746 }; | 758 }; |
| 747 for (const auto& conflicting_method : kConflictingMethods) { | 759 for (const auto& conflicting_method : kConflictingMethods) { |
| 748 if (old_method_name == conflicting_method) | 760 if (old_method_name == conflicting_method) |
| 749 return true; | 761 return true; |
| 750 } | 762 } |
| 751 | 763 |
| 752 return false; | 764 return false; |
| 753 } | 765 } |
| 754 | 766 |
| 755 AST_MATCHER(clang::FunctionDecl, shouldPrefixFunctionName) { | 767 AST_MATCHER(clang::FunctionDecl, shouldPrefixFunctionName) { |
| (...skipping 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1926 for (const auto& r : replacements) { | 1938 for (const auto& r : replacements) { |
| 1927 std::string replacement_text = r.getReplacementText().str(); | 1939 std::string replacement_text = r.getReplacementText().str(); |
| 1928 std::replace(replacement_text.begin(), replacement_text.end(), '\n', '\0'); | 1940 std::replace(replacement_text.begin(), replacement_text.end(), '\n', '\0'); |
| 1929 llvm::outs() << "r:::" << r.getFilePath() << ":::" << r.getOffset() | 1941 llvm::outs() << "r:::" << r.getFilePath() << ":::" << r.getOffset() |
| 1930 << ":::" << r.getLength() << ":::" << replacement_text << "\n"; | 1942 << ":::" << r.getLength() << ":::" << replacement_text << "\n"; |
| 1931 } | 1943 } |
| 1932 llvm::outs() << "==== END EDITS ====\n"; | 1944 llvm::outs() << "==== END EDITS ====\n"; |
| 1933 | 1945 |
| 1934 return 0; | 1946 return 0; |
| 1935 } | 1947 } |
| OLD | NEW |