Add template instantiations to the output of -ast-dump.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136306 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Misc/ast-dump-templates.cpp b/test/Misc/ast-dump-templates.cpp
new file mode 100644
index 0000000..6be36ec
--- /dev/null
+++ b/test/Misc/ast-dump-templates.cpp
@@ -0,0 +1,32 @@
+// RUN: %clang_cc1 -ast-dump %s | FileCheck %s
+
+template <int X, typename Y, int Z = 5>
+struct foo {
+ int constant;
+ foo() {}
+ Y getSum() { return Y(X + Z); }
+};
+
+template <int A, typename B>
+B bar() {
+ return B(A);
+}
+
+void baz() {
+ int x = bar<5, int>();
+ int y = foo<5, int>().getSum();
+ double z = foo<2, double, 3>().getSum();
+}
+
+// Template instantiation - foo
+// CHECK: template <int X = 5, typename Y = int, int Z = 5> struct foo {
+// CHECK: template <int X = 2, typename Y = double, int Z = 3> struct foo {
+
+// Template definition - foo
+// CHECK: template <int X, typename Y, int Z = (IntegerLiteral {{.*}} 'int' 5)
+
+// Template instantiation - bar
+// CHECK: template <int A = 5, typename B = int> int bar()
+
+// Template definition - bar
+// CHECK: template <int A, typename B> B bar()