Chromium Code Reviews| Index: tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp |
| diff --git a/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp b/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp |
| index 5d6d0b964b28fdfb6090b6b41928cc3875d52810..37a1ee3ea38ac637a99b2eaff4f08a7b70939fc5 100644 |
| --- a/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp |
| +++ b/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp |
| @@ -59,6 +59,10 @@ AST_MATCHER(clang::FunctionDecl, isOverloadedOperator) { |
| return Node.isOverloadedOperator(); |
| } |
| +AST_MATCHER(clang::CXXMethodDecl, isUserProvidedInstanceMethod) { |
| + return Node.isUserProvided() && Node.isInstance(); |
| +} |
| + |
| AST_MATCHER_P(clang::FunctionTemplateDecl, |
| templatedDecl, |
| clang::ast_matchers::internal::Matcher<clang::FunctionDecl>, |
| @@ -640,10 +644,11 @@ int main(int argc, const char* argv[]) { |
| // }; |
| // matches |x|, |y|, and |VALUE|. |
| auto field_decl_matcher = id("decl", fieldDecl(in_blink_namespace)); |
| - auto is_type_trait_value = |
| - varDecl(hasName("value"), hasStaticStorageDuration(), isPublic(), |
| - hasType(isConstQualified()), hasType(booleanType()), |
| - unless(hasAncestor(recordDecl(has(functionDecl()))))); |
| + auto is_type_trait_value = varDecl( |
| + hasName("value"), hasStaticStorageDuration(), isPublic(), |
| + hasType(isConstQualified()), hasType(booleanType()), |
| + unless(hasAncestor( |
| + recordDecl(has(cxxMethodDecl(isUserProvidedInstanceMethod())))))); |
|
dcheng
2016/09/01 21:04:21
Might be slightly nicer to compose the isUserProvi
Łukasz Anforowicz
2016/09/01 21:39:45
Done. Also - it turns out that isUserProvided is
|
| auto var_decl_matcher = |
| id("decl", varDecl(in_blink_namespace, unless(is_type_trait_value))); |
| auto enum_member_decl_matcher = |