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

Unified Diff: tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp

Issue 2307643002: Account for the fact that some type traits have static methods. (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
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 =

Powered by Google App Engine
This is Rietveld 408576698