summaryrefslogtreecommitdiff
path: root/test/PCH
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2015-11-04 03:40:30 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2015-11-04 03:40:30 +0000
commit6bb02a27b9161e772ec3fd64c8ee9955787d583e (patch)
tree9c233c030b85adee499edc3badf256ad989d31a1 /test/PCH
parent0c29653a59e47624ec37f4e607976449fb975f44 (diff)
downloadclang-6bb02a27b9161e772ec3fd64c8ee9955787d583e.tar.gz
[Sema] Implement __make_integer_seq
This new builtin template allows for incredibly fast instantiations of templates like std::integer_sequence. Performance numbers follow: My work station has 64 GB of ram + 20 Xeon Cores at 2.8 GHz. __make_integer_seq<std::integer_sequence, int, 90000> takes 0.25 seconds. std::make_integer_sequence<int, 90000> takes unbound time, it is still running. Clang is consuming gigabytes of memory. Differential Revision: http://reviews.llvm.org/D13786 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@252036 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/PCH')
-rw-r--r--test/PCH/make-integer-seq.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/PCH/make-integer-seq.cpp b/test/PCH/make-integer-seq.cpp
new file mode 100644
index 0000000000..3622c33449
--- /dev/null
+++ b/test/PCH/make-integer-seq.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -std=c++14 -x c++-header %s -emit-pch -o %t.pch
+// RUN: %clang_cc1 -std=c++14 -x c++ /dev/null -include-pch %t.pch
+
+template <class T, T... I>
+struct Seq {
+ static constexpr T PackSize = sizeof...(I);
+};
+
+template <typename T, T N>
+using MakeSeq = __make_integer_seq<Seq, T, N>;
+
+void fn1() {
+ MakeSeq<int, 3> x;
+}