Commit f408e22e authored by lukasza's avatar lukasza Committed by Commit bot

Extend |is_type_trait_value| matcher to cover |blink| namespace.

Also tighten up the matcher to also require that |value| field:
- is public,
- is inside a struct-or-class that doesn't have any methods.

BUG=640749

Review-Url: https://codereview.chromium.org/2283553002
Cr-Commit-Position: refs/heads/master@{#414751}
parent be9c59ee
...@@ -585,13 +585,12 @@ int main(int argc, const char* argv[]) { ...@@ -585,13 +585,12 @@ int main(int argc, const char* argv[]) {
// }; // };
// matches |x|, |y|, and |VALUE|. // matches |x|, |y|, and |VALUE|.
auto field_decl_matcher = id("decl", fieldDecl(in_blink_namespace)); auto field_decl_matcher = id("decl", fieldDecl(in_blink_namespace));
auto is_wtf_type_trait_value = auto is_type_trait_value =
varDecl(hasName("value"), hasStaticStorageDuration(), varDecl(hasName("value"), hasStaticStorageDuration(), isPublic(),
hasType(isConstQualified()), hasType(booleanType()), hasType(isConstQualified()), hasType(booleanType()),
hasAncestor(recordDecl(hasAncestor(namespaceDecl( unless(hasAncestor(recordDecl(has(functionDecl())))));
hasName("WTF"), hasParent(translationUnitDecl()))))));
auto var_decl_matcher = auto var_decl_matcher =
id("decl", varDecl(in_blink_namespace, unless(is_wtf_type_trait_value))); id("decl", varDecl(in_blink_namespace, unless(is_type_trait_value)));
auto enum_member_decl_matcher = auto enum_member_decl_matcher =
id("decl", enumConstantDecl(in_blink_namespace)); id("decl", enumConstantDecl(in_blink_namespace));
......
...@@ -65,6 +65,11 @@ union U { ...@@ -65,6 +65,11 @@ union U {
int has_prefix_; int has_prefix_;
}; };
// https://crbug.com/640749#c1: Some type traits are inside blink namespace.
struct IsGarbageCollectedMixin {
static const bool value = true;
};
} // namespace blink } // namespace blink
namespace WTF { namespace WTF {
...@@ -75,7 +80,7 @@ struct TypeTrait1 { ...@@ -75,7 +80,7 @@ struct TypeTrait1 {
static const bool value = true; static const bool value = true;
}; };
// Some type traits are implemented as classes, not structs // Some type traits are implemented as classes, not structs
// (e.g. WTF::IsGarbageCollectedType or WTF::IsAssignable). // (e.g. WTF::IsGarbageCollectedType or WTF::IsAssignable).
template <typename T> template <typename T>
class TypeTrait2 { class TypeTrait2 {
......
...@@ -62,6 +62,11 @@ union U { ...@@ -62,6 +62,11 @@ union U {
int m_hasPrefix; int m_hasPrefix;
}; };
// https://crbug.com/640749#c1: Some type traits are inside blink namespace.
struct IsGarbageCollectedMixin {
static const bool value = true;
};
} // namespace blink } // namespace blink
namespace WTF { namespace WTF {
...@@ -72,7 +77,7 @@ struct TypeTrait1 { ...@@ -72,7 +77,7 @@ struct TypeTrait1 {
static const bool value = true; static const bool value = true;
}; };
// Some type traits are implemented as classes, not structs // Some type traits are implemented as classes, not structs
// (e.g. WTF::IsGarbageCollectedType or WTF::IsAssignable). // (e.g. WTF::IsGarbageCollectedType or WTF::IsAssignable).
template <typename T> template <typename T>
class TypeTrait2 { class TypeTrait2 {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment