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

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

Issue 2283553002: Extend |is_type_trait_value| matcher to cover |blink| namespace. (Closed)
Patch Set: Self-review. Created 4 years, 3 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 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 571
572 // Field, variable, and enum declarations ======== 572 // Field, variable, and enum declarations ========
573 // Given 573 // Given
574 // int x; 574 // int x;
575 // struct S { 575 // struct S {
576 // int y; 576 // int y;
577 // enum { VALUE }; 577 // enum { VALUE };
578 // }; 578 // };
579 // matches |x|, |y|, and |VALUE|. 579 // matches |x|, |y|, and |VALUE|.
580 auto field_decl_matcher = id("decl", fieldDecl(in_blink_namespace)); 580 auto field_decl_matcher = id("decl", fieldDecl(in_blink_namespace));
581 auto is_wtf_type_trait_value = 581 auto is_type_trait_value =
582 varDecl(hasName("value"), hasStaticStorageDuration(), 582 varDecl(hasName("value"), hasStaticStorageDuration(), isPublic(),
583 hasType(isConstQualified()), hasType(booleanType()), 583 hasType(isConstQualified()), hasType(booleanType()),
584 hasAncestor(recordDecl(hasAncestor(namespaceDecl( 584 unless(hasAncestor(recordDecl(has(functionDecl())))));
585 hasName("WTF"), hasParent(translationUnitDecl()))))));
586 auto var_decl_matcher = 585 auto var_decl_matcher =
587 id("decl", varDecl(in_blink_namespace, unless(is_wtf_type_trait_value))); 586 id("decl", varDecl(in_blink_namespace, unless(is_type_trait_value)));
588 auto enum_member_decl_matcher = 587 auto enum_member_decl_matcher =
589 id("decl", enumConstantDecl(in_blink_namespace)); 588 id("decl", enumConstantDecl(in_blink_namespace));
590 589
591 FieldDeclRewriter field_decl_rewriter(&replacements); 590 FieldDeclRewriter field_decl_rewriter(&replacements);
592 match_finder.addMatcher(field_decl_matcher, &field_decl_rewriter); 591 match_finder.addMatcher(field_decl_matcher, &field_decl_rewriter);
593 592
594 VarDeclRewriter var_decl_rewriter(&replacements); 593 VarDeclRewriter var_decl_rewriter(&replacements);
595 match_finder.addMatcher(var_decl_matcher, &var_decl_rewriter); 594 match_finder.addMatcher(var_decl_matcher, &var_decl_rewriter);
596 595
597 EnumConstantDeclRewriter enum_member_decl_rewriter(&replacements); 596 EnumConstantDeclRewriter enum_member_decl_rewriter(&replacements);
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 for (const auto& r : replacements) { 864 for (const auto& r : replacements) {
866 std::string replacement_text = r.getReplacementText().str(); 865 std::string replacement_text = r.getReplacementText().str();
867 std::replace(replacement_text.begin(), replacement_text.end(), '\n', '\0'); 866 std::replace(replacement_text.begin(), replacement_text.end(), '\n', '\0');
868 llvm::outs() << "r:::" << r.getFilePath() << ":::" << r.getOffset() 867 llvm::outs() << "r:::" << r.getFilePath() << ":::" << r.getOffset()
869 << ":::" << r.getLength() << ":::" << replacement_text << "\n"; 868 << ":::" << r.getLength() << ":::" << replacement_text << "\n";
870 } 869 }
871 llvm::outs() << "==== END EDITS ====\n"; 870 llvm::outs() << "==== END EDITS ====\n";
872 871
873 return 0; 872 return 0;
874 } 873 }
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