diff options
author | Dmitri Gribenko <gribozavr@gmail.com> | 2013-02-21 22:01:10 +0000 |
---|---|---|
committer | Dmitri Gribenko <gribozavr@gmail.com> | 2013-02-21 22:01:10 +0000 |
commit | 4216ee1ed997b826470864182df34df1a350fcb7 (patch) | |
tree | 2ebe174c9b28e6bbbd2564f660833cbb1e6bd4e9 /test/Misc/ast-dump-decl.cpp | |
parent | 1c1303b1fa988ffae7e269fbdbd5a50e4ba860a0 (diff) |
AST dumping: dump template instantiations only once
Fixes infinite loop in PR15220.
Patch by Philip Craig.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175805 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Misc/ast-dump-decl.cpp')
-rw-r--r-- | test/Misc/ast-dump-decl.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/test/Misc/ast-dump-decl.cpp b/test/Misc/ast-dump-decl.cpp index d8072b727a..c8f7d2fe6c 100644 --- a/test/Misc/ast-dump-decl.cpp +++ b/test/Misc/ast-dump-decl.cpp @@ -251,6 +251,45 @@ namespace testClassTemplateDecl { // CHECK-NEXT: CXXRecordDecl{{.*}} class TestClassTemplatePartial // CHECK-NEXT: FieldDecl{{.*}} j +// PR15220 dump instantiation only once +namespace testCanonicalTemplate { + class A {}; + + template<typename T> void TestFunctionTemplate(T); + template<typename T> void TestFunctionTemplate(T); + void bar(A a) { TestFunctionTemplate(a); } + // CHECK: FunctionTemplateDecl{{.*}} TestFunctionTemplate + // CHECK-NEXT: TemplateTypeParmDecl + // CHECK-NEXT: FunctionDecl{{.*}} TestFunctionTemplate 'void (T)' + // CHECK-NEXT: ParmVarDecl{{.*}} 'T' + // CHECK-NEXT: FunctionDecl{{.*}} TestFunctionTemplate {{.*}}A + // CHECK-NEXT: TemplateArgument + // CHECK-NEXT: ParmVarDecl + // CHECK: FunctionTemplateDecl{{.*}} TestFunctionTemplate + // CHECK-NEXT: TemplateTypeParmDecl + // CHECK-NEXT: FunctionDecl{{.*}} TestFunctionTemplate 'void (T)' + // CHECK-NEXT: ParmVarDecl{{.*}} 'T' + // CHECK-NEXT: Function{{.*}} 'TestFunctionTemplate' + // CHECK-NEXT-NOT: TemplateArgument + + template<typename T1> class TestClassTemplate { + template<typename T2> friend class TestClassTemplate; + }; + TestClassTemplate<A> a; + // CHECK: ClassTemplateDecl{{.*}} TestClassTemplate + // CHECK-NEXT: TemplateTypeParmDecl + // CHECK-NEXT: CXXRecordDecl{{.*}} class TestClassTemplate + // CHECK-NEXT: CXXRecordDecl{{.*}} class TestClassTemplate + // CHECK-NEXT: FriendDecl + // CHECK-NEXT: ClassTemplateDecl{{.*}} TestClassTemplate + // CHECK-NEXT: TemplateTypeParmDecl + // CHECK-NEXT: CXXRecordDecl{{.*}} class TestClassTemplate + // CHECK-NEXT: ClassTemplateSpecialization{{.*}} 'TestClassTemplate' + // CHECK-NEXT: ClassTemplateSpecializationDecl{{.*}} class TestClassTemplate + // CHECK-NEXT: TemplateArgument{{.*}}A + // CHECK-NEXT: CXXRecordDecl{{.*}} class TestClassTemplate +} + template <class T> class TestClassScopeFunctionSpecialization { template<class U> void foo(U a) { } |