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

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

Issue 2569783002: When prepending "Get" to accessors, consider inheritance chain. (Closed)
Patch Set: Added test for non-virtual method scenario. Created 4 years 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
« no previous file with comments | « no previous file | tools/clang/rewrite_to_chrome_style/tests/methods-expected.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8e1cb077ff290bebc9d06a365dd4172f3a7dea5b..97d9ebd309706e2e64d64d88f1452ea64400d3ed 100644
--- a/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp
+++ b/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp
@@ -348,14 +348,19 @@ bool GetNameForDecl(const clang::FunctionDecl& decl,
// Given
// class Foo {};
+ // class DerivedFoo : class Foo;
// using Bar = Foo;
// Bar f1(); // <- |Bar| would be matched by hasString("Bar") below.
// Bar f2(); // <- |Bar| would be matched by hasName("Foo") below.
+ // DerivedFoo f3(); // <- |DerivedFoo| matched by isDerivedFrom(...) below.
// |type_with_same_name_as_function| matcher matches Bar and Foo return types.
auto type_with_same_name_as_function = qualType(anyOf(
- hasString(name), // hasString matches the type as spelled (Bar above).
- hasDeclaration(namedDecl(hasName(name))))); // hasDeclaration matches
- // resolved type (Foo above).
+ // hasString matches the type as spelled (Bar above).
+ hasString(name),
+ // hasDeclaration matches resolved type (Foo or DerivedFoo above).
+ hasDeclaration(namedDecl(hasName(name))),
+ hasDeclaration(cxxRecordDecl(isDerivedFrom(namedDecl(hasName(name)))))));
+
// |type_containing_same_name_as_function| matcher will match all of the
// return types below:
// - Foo foo() // Direct application of |type_with_same_name_as_function|.
« no previous file with comments | « no previous file | tools/clang/rewrite_to_chrome_style/tests/methods-expected.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698