Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(121)

Side by Side Diff: tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp

Issue 2799803003: Requiring Get prefix for 13 more methods (to avoid conflicts after Blink rename) (Closed)
Patch Set: git cl format Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 return CanBeEvaluatedAtCompileTime(initializer, context); 650 return CanBeEvaluatedAtCompileTime(initializer, context);
651 } 651 }
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[] = {"accumulatorMap",
661 "accumulatorMap", 661 "animationWorklet",
662 "animationWorklet", 662 "attrNodeList",
663 "audioWorklet", 663 "audioWorklet",
664 "binaryType", 664 "binaryType",
665 "blob", 665 "blob",
666 "channelCountMode", 666 "channelCountMode",
667 "color", 667 "color",
668 "compositorElementId", 668 "compositorElementId",
669 "counterDirectives", 669 "constructionStack",
670 "document", 670 "counterDirectives",
671 "element", 671 "counterMaps"
672 "emptyChromeClient", 672 "document",
673 "emptyEditorClient", 673 "element",
674 "emptySpellCheckerClient", 674 "emptyChromeClient",
675 "entryType", 675 "emptyEditorClient",
676 "error", 676 "emptySpellCheckerClient",
677 "eventTargetDataMap", 677 "entryType",
678 "fileUtilities", 678 "error",
679 "font", 679 "eventTargetDataMap",
680 "frame", 680 "fileUtilities",
681 "frameBlameContext", 681 "font",
682 "frontend", 682 "frame",
683 "gridCell", 683 "frameBlameContext",
684 "hash", 684 "frontend",
685 "heapObjectHeader", 685 "gridCell",
686 "heapObjectSet", 686 "harfBuzzFontCache",
687 "iconURL", 687 "hash",
688 "image", 688 "heapObjectHeader",
689 "inputMethodController", 689 "heapObjectSet",
690 "inputType", 690 "iconURL",
691 "interpolationTypes", 691 "image",
692 "layout", 692 "infoMap",
693 "layoutBlock", 693 "inputMethodController",
694 "layoutObject", 694 "inputType",
695 "layoutSize", 695 "interpolationTypes",
696 "lineCap", 696 "intervalArena",
697 "lineEndings", 697 "layout",
698 "lineJoin", 698 "layoutBlock",
699 "listItems", 699 "layoutObject",
700 "matchedProperties", 700 "layoutSize",
701 "midpointState", 701 "lineCap",
702 "modifiers", 702 "lineEndings",
703 "mouseEvent", 703 "lineJoin",
704 "name", 704 "listItems",
705 "navigationType", 705 "matchedProperties",
706 "node", 706 "midpointState",
707 "notificationManager", 707 "modifiers",
708 "outcome", 708 "mouseEvent",
709 "pagePopup", 709 "name",
710 "paintWorklet", 710 "navigationType",
711 "path", 711 "node",
712 "position", 712 "notificationManager",
713 "processingInstruction", 713 "originAccessMap",
714 "qualifiedNameCache", 714 "outcome",
715 "readyState", 715 "pagePopup",
716 "relList", 716 "paintWorklet",
717 "referrer", 717 "path",
718 "referrerPolicy", 718 "position",
719 "resource", 719 "presentationAttributeCache",
720 "response", 720 "processingInstruction",
721 "restrictedKeyMap", 721 "qualifiedNameCache",
722 "sandboxSupport", 722 "readyState",
723 "screenInfo", 723 "relList",
724 "screenOrientationController", 724 "referrer",
725 "scrollAnimator", 725 "referrerPolicy",
726 "selectionInDOMTree", 726 "resource",
727 "selectionInFlatTree", 727 "response",
728 "selectorTextCache", 728 "restrictedKeyMap",
729 "settings", 729 "sandboxSupport",
730 "signalingState", 730 "screenInfo",
731 "snapshotById", 731 "screenOrientationController",
732 "state", 732 "scrollAnimator",
733 "string", 733 "selectionInDOMTree",
734 "styleSheet", 734 "selectionInFlatTree",
735 "supplementable", 735 "selectionVisualRectMap",
736 "text", 736 "selectorTextCache",
737 "textAlign", 737 "settings",
738 "textBaseline", 738 "signalingState",
739 "theme", 739 "snapshotById",
740 "thread", 740 "state",
741 "timing", 741 "string",
742 "topLevelBlameContext", 742 "styleSharingList",
743 "type", 743 "styleSheet",
744 "vector", 744 "supplementable",
745 "visibleSelection", 745 "text",
746 "visibleSelectionInFlatTree", 746 "textAlign",
747 "webFrame", 747 "textBaseline",
748 "widget", 748 "theme",
749 "wordBoundaries", 749 "thread",
750 "wrapperTypeInfo", 750 "timing",
751 }; 751 "topLevelBlameContext",
752 "type",
753 "vector",
754 "visibleSelection",
755 "visibleSelectionInFlatTree",
756 "weakHeapObjectSet",
757 "webFrame",
758 "widget",
759 "wordBoundaries",
760 "worldMap",
761 "wrapperTypeInfo"};
752 for (const auto& conflicting_method : kConflictingMethods) { 762 for (const auto& conflicting_method : kConflictingMethods) {
753 if (old_method_name == conflicting_method) 763 if (old_method_name == conflicting_method)
754 return true; 764 return true;
755 } 765 }
756 766
757 return false; 767 return false;
758 } 768 }
759 769
760 AST_MATCHER(clang::FunctionDecl, shouldPrefixFunctionName) { 770 AST_MATCHER(clang::FunctionDecl, shouldPrefixFunctionName) {
761 return Node.getDeclName().isIdentifier() && 771 return Node.getDeclName().isIdentifier() &&
(...skipping 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after
1931 for (const auto& r : replacements) { 1941 for (const auto& r : replacements) {
1932 std::string replacement_text = r.getReplacementText().str(); 1942 std::string replacement_text = r.getReplacementText().str();
1933 std::replace(replacement_text.begin(), replacement_text.end(), '\n', '\0'); 1943 std::replace(replacement_text.begin(), replacement_text.end(), '\n', '\0');
1934 llvm::outs() << "r:::" << r.getFilePath() << ":::" << r.getOffset() 1944 llvm::outs() << "r:::" << r.getFilePath() << ":::" << r.getOffset()
1935 << ":::" << r.getLength() << ":::" << replacement_text << "\n"; 1945 << ":::" << r.getLength() << ":::" << replacement_text << "\n";
1936 } 1946 }
1937 llvm::outs() << "==== END EDITS ====\n"; 1947 llvm::outs() << "==== END EDITS ====\n";
1938 1948
1939 return 0; 1949 return 0;
1940 } 1950 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698