Fix build for future versions of Clang.
[WebKit-https.git] / Tools / TestWebKitAPI / Counters.h
index 1335d2b..f9ea224 100644 (file)
@@ -65,22 +65,35 @@ struct ConstructorDestructorCounter {
     ~ConstructorDestructorCounter() { destructionCount++; }
 };
 
+#if COMPILER(CLANG)
+#if __has_warning("-Wundefined-var-template")
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wundefined-var-template"
+#endif
+#endif
 template<typename T>
 struct DeleterCounter {
-    static unsigned deleterCount;
+    static unsigned m_deleterCount;
+
+    static unsigned deleterCount() { return m_deleterCount; }
 
     struct TestingScope {
         TestingScope()
         {
-            deleterCount = 0;
+            m_deleterCount = 0;
         }
     };
 
     void operator()(T* p) const
     {
-        deleterCount++;
+        m_deleterCount++;
         delete p;
     }
 };
+#if COMPILER(CLANG)
+#if __has_warning("-Wundefined-var-template")
+#pragma clang diagnostic pop
+#endif
+#endif
 
 #endif // Counters_h