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 3a19515c190ac61352db73b703e20e33987e67ac..6be0dd649d67f1cacc0cc6ad9f166e8014e5503c 100644 |
--- a/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp |
+++ b/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp |
@@ -101,17 +101,6 @@ AST_MATCHER_P(clang::OverloadExpr, |
return true; |
} |
-bool IsDeclContextInWTF(const clang::DeclContext* decl_context) { |
- auto* namespace_decl = clang::dyn_cast_or_null<clang::NamespaceDecl>( |
- decl_context->getEnclosingNamespaceContext()); |
- if (!namespace_decl) |
- return false; |
- if (namespace_decl->getParent()->isTranslationUnit() && |
- namespace_decl->getName() == "WTF") |
- return true; |
- return IsDeclContextInWTF(namespace_decl->getParent()); |
-} |
- |
template <typename T> |
bool MatchAllOverriddenMethods( |
const clang::CXXMethodDecl& decl, |
@@ -453,15 +442,6 @@ bool GetNameForDecl(const clang::VarDecl& decl, |
bool is_const = IsProbablyConst(decl, context); |
if (is_const) { |
- // Struct consts in WTF do not become kFoo cuz stuff like type traits |
- // should stay as lowercase. |
- const clang::DeclContext* decl_context = decl.getDeclContext(); |
- bool is_in_wtf = IsDeclContextInWTF(decl_context); |
- const clang::CXXRecordDecl* parent = |
- clang::dyn_cast_or_null<clang::CXXRecordDecl>(decl_context); |
- if (is_in_wtf && parent && parent->isStruct()) |
- return false; |
- |
if (!GetNameForConstant(original_name.str(), name)) |
return false; |
} else { |
@@ -855,7 +835,14 @@ int main(int argc, const char* argv[]) { |
// }; |
// matches |x|, |y|, and |VALUE|. |
auto field_decl_matcher = id("decl", fieldDecl(in_blink_namespace)); |
- auto var_decl_matcher = id("decl", varDecl(in_blink_namespace)); |
+ auto var_decl_matcher = id( |
+ "decl", |
+ varDecl(in_blink_namespace, |
+ unless(varDecl( // Unless it is a type trait's static value. |
dcheng
2016/08/25 03:05:33
I'd recommend capturing the varDecl(hasName("value
Łukasz Anforowicz
2016/08/25 21:31:41
Done.
|
+ hasName("value"), hasStaticStorageDuration(), |
Łukasz Anforowicz
2016/08/24 22:36:20
BTW: All static fields in wtf/TypeTraits.h are nam
|
+ hasType(isConstQualified()), hasType(booleanType()), |
+ hasAncestor(recordDecl(hasAncestor(namespaceDecl( |
+ hasName("WTF"), hasParent(translationUnitDecl()))))))))); |
auto enum_member_decl_matcher = |
id("decl", enumConstantDecl(in_blink_namespace)); |