| Index: tools/clang/rewrite_to_chrome_style/tests/fields-original.cc
|
| diff --git a/tools/clang/rewrite_to_chrome_style/tests/fields-original.cc b/tools/clang/rewrite_to_chrome_style/tests/fields-original.cc
|
| index 52dd12e079f776c7fce795993864c6bff2c31581..726c521584cdb40de74072f4f6e4ac8f8e18cec6 100644
|
| --- a/tools/clang/rewrite_to_chrome_style/tests/fields-original.cc
|
| +++ b/tools/clang/rewrite_to_chrome_style/tests/fields-original.cc
|
| @@ -72,13 +72,14 @@ struct IsGarbageCollectedMixin {
|
| namespace WTF {
|
|
|
| // We don't want to capitalize fields in type traits
|
| -// (i.e. no |value| -> |kValue| rename is undesirable below).
|
| +// (i.e. the |value| -> |kValue| rename is undesirable below).
|
| struct TypeTrait1 {
|
| static const bool value = true;
|
| };
|
|
|
| // Some type traits are implemented as classes, not structs
|
| // (e.g. WTF::IsGarbageCollectedType or WTF::IsAssignable).
|
| +// We should not perform a |value| -> |kValue| rename in the type trait below.
|
| template <typename T>
|
| class TypeTrait2 {
|
| public:
|
| @@ -90,6 +91,57 @@ class TypeTrait2<void> {
|
| static const bool value = false;
|
| };
|
|
|
| +// Some type traits have static methods. We should not perform
|
| +// a |value| -> |kValue| rename in the type trait below.
|
| +template <typename T, typename U>
|
| +struct IsSubclass {
|
| + private:
|
| + typedef char YesType;
|
| + struct NoType {
|
| + char padding[8];
|
| + };
|
| +
|
| + static YesType subclassCheck(U*);
|
| + static NoType subclassCheck(...);
|
| + static T* t;
|
| +
|
| + public:
|
| + static const bool value = sizeof(subclassCheck(t)) == sizeof(YesType);
|
| +};
|
| +
|
| +// Some type traits have deleted instance methods. We should not perform
|
| +// a |value| -> |kValue| rename in the type trait below.
|
| +template <typename U = void>
|
| +struct IsTraceableInCollection {
|
| + // Expanded from STATIC_ONLY(IsTraceableInCollection) macro:
|
| + private:
|
| + IsTraceableInCollection() = delete;
|
| + IsTraceableInCollection(const IsTraceableInCollection&) = delete;
|
| + IsTraceableInCollection& operator=(const IsTraceableInCollection&) = delete;
|
| + void* operator new(unsigned long) = delete;
|
| + void* operator new(unsigned long, void*) = delete;
|
| +
|
| + public:
|
| + static const bool value = true;
|
| +};
|
| +
|
| +// Some type traits have a non-boolean value.
|
| +enum LifetimeManagementType {
|
| + RefCountedLifetime,
|
| + GarbageCollectedLifetime,
|
| +};
|
| +template <typename T>
|
| +struct LifetimeOf {
|
| + private:
|
| + // Okay to rename |isGarbageCollected| to |kIsGarbageCollected|.
|
| + static const bool isGarbageCollected = true;
|
| +
|
| + public:
|
| + // Expecting no rename of |value|.
|
| + static const LifetimeManagementType value =
|
| + !isGarbageCollected ? RefCountedLifetime : GarbageCollectedLifetime;
|
| +};
|
| +
|
| }; // namespace WTF
|
|
|
| void F() {
|
|
|