diff options
author | Gabor Horvath <xazax.hun@gmail.com> | 2018-02-10 14:04:45 +0000 |
---|---|---|
committer | Gabor Horvath <xazax.hun@gmail.com> | 2018-02-10 14:04:45 +0000 |
commit | c963abc492c42effaeea2dfc61d1177f08c3a44f (patch) | |
tree | c1efeacb5153a6b8ef2894ec8761c1110434c240 /test/Templight/templight-explicit-template-arg.cpp | |
parent | 8d0b5771e42ee079be1cb3475a65af2220847a44 (diff) | |
download | clang-c963abc492c42effaeea2dfc61d1177f08c3a44f.tar.gz |
[Templight] Template Instantiation Observer
This patch adds a base-class called TemplateInstantiationObserver which gets
notified whenever a template instantiation is entered or exited during
semantic analysis. This is a base class used to implement the template
profiling and debugging tool called
Templight (https://github.com/mikael-s-persson/templight).
The patch also makes a few more changes:
* ActiveTemplateInstantiation class is moved out of the Sema class (so it can be used with inclusion of Sema.h).
* CreateFrontendAction function in front-end utilities is given external linkage (not longer a hidden static function).
* TemplateInstObserverChain data member added to Sema class to hold the list of template-inst observers.
* Notifications to the template-inst observer are added at the key places where templates are instantiated.
Patch by: Abel Sinkovics!
Differential Revision: https://reviews.llvm.org/D5767
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324808 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Templight/templight-explicit-template-arg.cpp')
-rw-r--r-- | test/Templight/templight-explicit-template-arg.cpp | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/test/Templight/templight-explicit-template-arg.cpp b/test/Templight/templight-explicit-template-arg.cpp new file mode 100644 index 0000000000..678cba28cd --- /dev/null +++ b/test/Templight/templight-explicit-template-arg.cpp @@ -0,0 +1,59 @@ +// RUN: %clang_cc1 -templight-dump %s 2>&1 | FileCheck %s +template <class T> +void f(){} + +int main() +{ +// CHECK-LABEL: {{^---$}} +// CHECK: {{^name:[ ]+f$}} +// CHECK: {{^kind:[ ]+ExplicitTemplateArgumentSubstitution$}} +// CHECK: {{^event:[ ]+Begin$}} +// CHECK: {{^orig:[ ]+'.*templight-explicit-template-arg.cpp:3:6'}} +// CHECK: {{^poi:[ ]+'.*templight-explicit-template-arg.cpp:58:3'$}} +// CHECK-LABEL: {{^---$}} +// CHECK: {{^name:[ ]+f$}} +// CHECK: {{^kind:[ ]+ExplicitTemplateArgumentSubstitution$}} +// CHECK: {{^event:[ ]+End$}} +// CHECK: {{^orig:[ ]+'.*templight-explicit-template-arg.cpp:3:6'}} +// CHECK: {{^poi:[ ]+'.*templight-explicit-template-arg.cpp:58:3'$}} +// +// CHECK-LABEL: {{^---$}} +// CHECK: {{^name:[ ]+f$}} +// CHECK: {{^kind:[ ]+DeducedTemplateArgumentSubstitution$}} +// CHECK: {{^event:[ ]+Begin$}} +// CHECK: {{^orig:[ ]+'.*templight-explicit-template-arg.cpp:3:6'}} +// CHECK: {{^poi:[ ]+'.*templight-explicit-template-arg.cpp:58:3'$}} +// CHECK-LABEL: {{^---$}} +// CHECK: {{^name:[ ]+f$}} +// CHECK: {{^kind:[ ]+DeducedTemplateArgumentSubstitution$}} +// CHECK: {{^event:[ ]+End$}} +// CHECK: {{^orig:[ ]+'.*templight-explicit-template-arg.cpp:3:6'}} +// CHECK: {{^poi:[ ]+'.*templight-explicit-template-arg.cpp:58:3'$}} +// +// CHECK-LABEL: {{^---$}} +// CHECK: {{^name:[ ]+'f<int>'$}} +// CHECK: {{^kind:[ ]+TemplateInstantiation$}} +// CHECK: {{^event:[ ]+Begin$}} +// CHECK: {{^orig:[ ]+'.*templight-explicit-template-arg.cpp:3:6'}} +// CHECK: {{^poi:[ ]+'.*templight-explicit-template-arg.cpp:58:3'$}} +// CHECK-LABEL: {{^---$}} +// CHECK: {{^name:[ ]+'f<int>'$}} +// CHECK: {{^kind:[ ]+TemplateInstantiation$}} +// CHECK: {{^event:[ ]+End$}} +// CHECK: {{^orig:[ ]+'.*templight-explicit-template-arg.cpp:3:6'}} +// CHECK: {{^poi:[ ]+'.*templight-explicit-template-arg.cpp:58:3'$}} +// +// CHECK-LABEL: {{^---$}} +// CHECK: {{^name:[ ]+'f<int>'$}} +// CHECK: {{^kind:[ ]+TemplateInstantiation$}} +// CHECK: {{^event:[ ]+Begin$}} +// CHECK: {{^orig:[ ]+'.*templight-explicit-template-arg.cpp:3:6'}} +// CHECK: {{^poi:[ ]+'.*templight-explicit-template-arg.cpp:58:3'$}} +// CHECK-LABEL: {{^---$}} +// CHECK: {{^name:[ ]+'f<int>'$}} +// CHECK: {{^kind:[ ]+TemplateInstantiation$}} +// CHECK: {{^event:[ ]+End$}} +// CHECK: {{^orig:[ ]+'.*templight-explicit-template-arg.cpp:3:6'}} +// CHECK: {{^poi:[ ]+'.*templight-explicit-template-arg.cpp:58:3'$}} + f<int>(); +} |