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

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

Issue 2655943003: Rename references to type traits the same as we rename the traits. (Closed)
Patch Set: Created 3 years, 11 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 | tools/clang/rewrite_to_chrome_style/tests/fields-expected.cc » ('j') | 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 1515 matching lines...) Expand 10 before | Expand all | Expand 10 after
1526 "expr", 1526 "expr",
1527 memberExpr( 1527 memberExpr(
1528 member(field_decl_matcher), 1528 member(field_decl_matcher),
1529 // Needed to avoid matching member references in functions (which will 1529 // Needed to avoid matching member references in functions (which will
1530 // be an ancestor of the member reference) synthesized by the 1530 // be an ancestor of the member reference) synthesized by the
1531 // compiler, such as a synthesized copy constructor. 1531 // compiler, such as a synthesized copy constructor.
1532 // This skips explicitly defaulted functions as well, but that's OK: 1532 // This skips explicitly defaulted functions as well, but that's OK:
1533 // there's nothing interesting to rewrite in those either. 1533 // there's nothing interesting to rewrite in those either.
1534 unless(hasAncestor(functionDecl(isDefaulted()))))); 1534 unless(hasAncestor(functionDecl(isDefaulted())))));
1535 auto decl_ref_matcher = id("expr", declRefExpr(to(var_decl_matcher))); 1535 auto decl_ref_matcher = id("expr", declRefExpr(to(var_decl_matcher)));
1536 auto type_trait_ref_matcher = id("expr", declRefExpr(to(type_trait_matcher)));
1536 auto enum_member_ref_matcher = 1537 auto enum_member_ref_matcher =
1537 id("expr", declRefExpr(to(enum_member_decl_matcher))); 1538 id("expr", declRefExpr(to(enum_member_decl_matcher)));
1538 1539
1539 MemberRewriter member_rewriter(&replacements); 1540 MemberRewriter member_rewriter(&replacements);
1540 match_finder.addMatcher(member_matcher, &member_rewriter); 1541 match_finder.addMatcher(member_matcher, &member_rewriter);
1541 1542
1542 DeclRefRewriter decl_ref_rewriter(&replacements); 1543 DeclRefRewriter decl_ref_rewriter(&replacements);
1543 match_finder.addMatcher(decl_ref_matcher, &decl_ref_rewriter); 1544 match_finder.addMatcher(decl_ref_matcher, &decl_ref_rewriter);
1544 1545
1546 DeclRefRewriter type_trait_ref_rewriter(&replacements);
1547 type_trait_ref_rewriter.set_for_type_traits(true);
1548 match_finder.addMatcher(type_trait_ref_matcher, &type_trait_ref_rewriter);
1549
1545 EnumConstantDeclRefRewriter enum_member_ref_rewriter(&replacements); 1550 EnumConstantDeclRefRewriter enum_member_ref_rewriter(&replacements);
1546 match_finder.addMatcher(enum_member_ref_matcher, &enum_member_ref_rewriter); 1551 match_finder.addMatcher(enum_member_ref_matcher, &enum_member_ref_rewriter);
1547 1552
1548 // Member references in a non-member context ======== 1553 // Member references in a non-member context ========
1549 // Given 1554 // Given
1550 // struct S { 1555 // struct S {
1551 // typedef int U::*UnspecifiedBoolType; 1556 // typedef int U::*UnspecifiedBoolType;
1552 // operator UnspecifiedBoolType() { return s_ ? &U::s_ : 0; } 1557 // operator UnspecifiedBoolType() { return s_ ? &U::s_ : 0; }
1553 // int s_; 1558 // int s_;
1554 // }; 1559 // };
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
1850 for (const auto& r : replacements) { 1855 for (const auto& r : replacements) {
1851 std::string replacement_text = r.getReplacementText().str(); 1856 std::string replacement_text = r.getReplacementText().str();
1852 std::replace(replacement_text.begin(), replacement_text.end(), '\n', '\0'); 1857 std::replace(replacement_text.begin(), replacement_text.end(), '\n', '\0');
1853 llvm::outs() << "r:::" << r.getFilePath() << ":::" << r.getOffset() 1858 llvm::outs() << "r:::" << r.getFilePath() << ":::" << r.getOffset()
1854 << ":::" << r.getLength() << ":::" << replacement_text << "\n"; 1859 << ":::" << r.getLength() << ":::" << replacement_text << "\n";
1855 } 1860 }
1856 llvm::outs() << "==== END EDITS ====\n"; 1861 llvm::outs() << "==== END EDITS ====\n";
1857 1862
1858 return 0; 1863 return 0;
1859 } 1864 }
OLDNEW
« no previous file with comments | « no previous file | tools/clang/rewrite_to_chrome_style/tests/fields-expected.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698