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[]) {
// };
// matches |x|, |y|, and |VALUE|.
auto field_decl_matcher = id("decl", fieldDecl(in_blink_namespace));
auto is_wtf_type_trait_value =
varDecl(hasName("value"), hasStaticStorageDuration(),
auto is_type_trait_value =
varDecl(hasName("value"), hasStaticStorageDuration(), isPublic(),
hasType(isConstQualified()), hasType(booleanType()),
hasAncestor(recordDecl(hasAncestor(namespaceDecl(
hasName("WTF"), hasParent(translationUnitDecl()))))));
unless(hasAncestor(recordDecl(has(functionDecl())))));
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 =
id("decl", enumConstantDecl(in_blink_namespace));
......
......@@ -65,6 +65,11 @@ union U {
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 WTF {
......@@ -75,7 +80,7 @@ struct TypeTrait1 {
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).
template <typename T>
class TypeTrait2 {
......
......@@ -62,6 +62,11 @@ union U {
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 WTF {
......@@ -72,7 +77,7 @@ struct TypeTrait1 {
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).
template <typename T>
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