[libcxx-commits] [libcxx] r363503 - add header to help with template testing
Eric Fiselier via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Jun 15 14:16:57 PDT 2019
Author: ericwf
Date: Sat Jun 15 14:16:57 2019
New Revision: 363503
URL: http://llvm.org/viewvc/llvm-project?rev=363503&view=rev
Log:
add header to help with template testing
Added:
libcxx/trunk/test/support/template_cost_testing.h
Added: libcxx/trunk/test/support/template_cost_testing.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/template_cost_testing.h?rev=363503&view=auto
==============================================================================
--- libcxx/trunk/test/support/template_cost_testing.h (added)
+++ libcxx/trunk/test/support/template_cost_testing.h Sat Jun 15 14:16:57 2019
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+#ifndef TEST_SUPPORT_TEMPLATE_COST_TESTING_H
+#define TEST_SUPPORT_TEMPLATE_COST_TESTING_H
+
+// This file contains macros used to repeat an expression many times.
+// This is useful for testing the compile time and memory usage
+// of templates.
+
+#define REPEAT_10(DO_IT) \
+ DO_IT() DO_IT() DO_IT() DO_IT() DO_IT() \
+ DO_IT() DO_IT() DO_IT() DO_IT() DO_IT()
+#define REPEAT_100(DO_IT) \
+ REPEAT_10(DO_IT) REPEAT_10(DO_IT) REPEAT_10(DO_IT) REPEAT_10(DO_IT) REPEAT_10(DO_IT) \
+ REPEAT_10(DO_IT) REPEAT_10(DO_IT) REPEAT_10(DO_IT) REPEAT_10(DO_IT) REPEAT_10(DO_IT)
+#define REPEAT_200(DO_IT) \
+ REPEAT_100(DO_IT) REPEAT_100(DO_IT)
+#define REPEAT_300(DO_IT) \
+ REPEAT_100(DO_IT) REPEAT_100(DO_IT) REPEAT_100(DO_IT)
+#define REPEAT_500(DO_IT) \
+ REPEAT_100(DO_IT) REPEAT_100(DO_IT) REPEAT_100(DO_IT) REPEAT_100(DO_IT) REPEAT_100(DO_IT)
+#define REPEAT_1000(DO_IT) \
+ REPEAT_100(DO_IT) REPEAT_100(DO_IT) REPEAT_100(DO_IT) REPEAT_100(DO_IT) REPEAT_100(DO_IT) \
+ REPEAT_100(DO_IT) REPEAT_100(DO_IT) REPEAT_100(DO_IT) REPEAT_100(DO_IT) REPEAT_100(DO_IT)
+#define REPEAT_5000(DO_IT) \
+ REPEAT_1000(DO_IT) REPEAT_1000(DO_IT) REPEAT_1000(DO_IT) REPEAT_1000(DO_IT) REPEAT_1000(DO_IT)
+#define REPEAT_10000(DO_IT) \
+ REPEAT_1000(DO_IT) REPEAT_1000(DO_IT) REPEAT_1000(DO_IT) REPEAT_1000(DO_IT) REPEAT_1000(DO_IT) \
+ REPEAT_1000(DO_IT) REPEAT_1000(DO_IT) REPEAT_1000(DO_IT) REPEAT_1000(DO_IT) REPEAT_1000(DO_IT)
+
+#endif // TEST_SUPPORT_TEMPLATE_COST_TESTING_H
More information about the libcxx-commits
mailing list