| 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 c506b5290f76db50589e1f6ea8ecc9edc41b845e..1e22e9c0ce33cd15cb3b26fe6711bae7d2b115ab 100644
|
| --- a/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp
|
| +++ b/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp
|
| @@ -144,6 +144,18 @@ AST_MATCHER_P(clang::CXXMethodDecl,
|
| return MatchAllOverriddenMethods(Node, InnerMatcher, Finder, Builder);
|
| }
|
|
|
| +bool IsMethodOverrideOf(const clang::CXXMethodDecl& decl,
|
| + const char* class_name) {
|
| + if (decl.getParent()->getQualifiedNameAsString() == class_name)
|
| + return true;
|
| + for (auto it = decl.begin_overridden_methods();
|
| + it != decl.end_overridden_methods(); ++it) {
|
| + if (IsMethodOverrideOf(**it, class_name))
|
| + return true;
|
| + }
|
| + return false;
|
| +}
|
| +
|
| bool IsBlacklistedMethod(const clang::CXXMethodDecl& decl) {
|
| if (decl.isStatic())
|
| return false;
|
| @@ -161,15 +173,23 @@ bool IsBlacklistedMethod(const clang::CXXMethodDecl& decl) {
|
| // Iterator methods shouldn't be renamed to work with stl and range-for
|
| // loops.
|
| std::string ret_type = decl.getReturnType().getAsString();
|
| - if (ret_type.find("iterator") == std::string::npos &&
|
| - ret_type.find("Iterator") == std::string::npos)
|
| - return false;
|
| - static const char* kIteratorBlacklist[] = {"begin", "end", "rbegin", "rend"};
|
| - for (const auto& b : kIteratorBlacklist) {
|
| - if (name == b)
|
| - return true;
|
| + if (ret_type.find("iterator") != std::string::npos ||
|
| + ret_type.find("Iterator") != std::string::npos) {
|
| + static const char* kIteratorBlacklist[] = {"begin", "end", "rbegin",
|
| + "rend"};
|
| + for (const auto& b : kIteratorBlacklist) {
|
| + if (name == b)
|
| + return true;
|
| + }
|
| }
|
|
|
| + // Subclasses of InspectorAgent will subclass "disable()" from both blink and
|
| + // from gen/, which is problematic, but DevTools folks don't want to rename
|
| + // it or split this up. So don't rename it at all.
|
| + if (name.equals("disable") &&
|
| + IsMethodOverrideOf(decl, "blink::InspectorAgent"))
|
| + return true;
|
| +
|
| return false;
|
| }
|
|
|
|
|