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 | 207e7b1fa179c359182c25f76dfc18bb757166e5 (patch) | |
| tree | 36bc16b08c2fca0bbb694a921069c7800c7955f9 /clang/test/Templight/templight-default-func-arg.cpp | |
| parent | ec81ae37bd835b4d3d89d5e7ac1aeb17a636b752 (diff) | |
| download | bcm5719-llvm-207e7b1fa179c359182c25f76dfc18bb757166e5.tar.gz bcm5719-llvm-207e7b1fa179c359182c25f76dfc18bb757166e5.zip | |
[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
llvm-svn: 324808
Diffstat (limited to 'clang/test/Templight/templight-default-func-arg.cpp')
| -rw-r--r-- | clang/test/Templight/templight-default-func-arg.cpp | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/clang/test/Templight/templight-default-func-arg.cpp b/clang/test/Templight/templight-default-func-arg.cpp new file mode 100644 index 00000000000..19e60393797 --- /dev/null +++ b/clang/test/Templight/templight-default-func-arg.cpp @@ -0,0 +1,73 @@ +// RUN: %clang_cc1 -std=c++14 -templight-dump %s 2>&1 | FileCheck %s +template <class T> +void foo(T b = 0) {}; + +int main() +{ + +// CHECK-LABEL: {{^---$}} +// CHECK: {{^name:[ ]+foo$}} +// CHECK: {{^kind:[ ]+ExplicitTemplateArgumentSubstitution$}} +// CHECK: {{^event:[ ]+Begin$}} +// CHECK: {{^orig:[ ]+'.*templight-default-func-arg.cpp:3:6'}} +// CHECK: {{^poi:[ ]+'.*templight-default-func-arg.cpp:72:3'$}} +// CHECK-LABEL: {{^---$}} +// CHECK: {{^name:[ ]+foo$}} +// CHECK: {{^kind:[ ]+ExplicitTemplateArgumentSubstitution$}} +// CHECK: {{^event:[ ]+End$}} +// CHECK: {{^orig:[ ]+'.*templight-default-func-arg.cpp:3:6'}} +// CHECK: {{^poi:[ ]+'.*templight-default-func-arg.cpp:72:3'$}} +// +// CHECK-LABEL: {{^---$}} +// CHECK: {{^name:[ ]+foo$}} +// CHECK: {{^kind:[ ]+DeducedTemplateArgumentSubstitution$}} +// CHECK: {{^event:[ ]+Begin$}} +// CHECK: {{^orig:[ ]+'.*templight-default-func-arg.cpp:3:6'}} +// CHECK: {{^poi:[ ]+'.*templight-default-func-arg.cpp:72:3'$}} +// CHECK-LABEL: {{^---$}} +// CHECK: {{^name:[ ]+foo$}} +// CHECK: {{^kind:[ ]+DeducedTemplateArgumentSubstitution$}} +// CHECK: {{^event:[ ]+End$}} +// CHECK: {{^orig:[ ]+'.*templight-default-func-arg.cpp:3:6'}} +// CHECK: {{^poi:[ ]+'.*templight-default-func-arg.cpp:72:3'$}} +// +// CHECK-LABEL: {{^---$}} +// CHECK: {{^name:[ ]+'foo<int>'$}} +// CHECK: {{^kind:[ ]+TemplateInstantiation$}} +// CHECK: {{^event:[ ]+Begin$}} +// CHECK: {{^orig:[ ]+'.*templight-default-func-arg.cpp:3:6'}} +// CHECK: {{^poi:[ ]+'.*templight-default-func-arg.cpp:72:3'$}} +// CHECK-LABEL: {{^---$}} +// CHECK: {{^name:[ ]+'foo<int>'$}} +// CHECK: {{^kind:[ ]+TemplateInstantiation$}} +// CHECK: {{^event:[ ]+End$}} +// CHECK: {{^orig:[ ]+'.*templight-default-func-arg.cpp:3:6'}} +// CHECK: {{^poi:[ ]+'.*templight-default-func-arg.cpp:72:3'$}} +// +// CHECK-LABEL: {{^---$}} +// CHECK: {{^name:[ ]+b$}} +// CHECK: {{^kind:[ ]+DefaultFunctionArgumentInstantiation$}} +// CHECK: {{^event:[ ]+Begin$}} +// CHECK: {{^orig:[ ]+'.*templight-default-func-arg.cpp:3:12'}} +// CHECK: {{^poi:[ ]+'.*templight-default-func-arg.cpp:72:3'$}} +// CHECK-LABEL: {{^---$}} +// CHECK: {{^name:[ ]+b$}} +// CHECK: {{^kind:[ ]+DefaultFunctionArgumentInstantiation$}} +// CHECK: {{^event:[ ]+End$}} +// CHECK: {{^orig:[ ]+'.*templight-default-func-arg.cpp:3:12'}} +// CHECK: {{^poi:[ ]+'.*templight-default-func-arg.cpp:72:3'$}} +// +// CHECK-LABEL: {{^---$}} +// CHECK: {{^name:[ ]+'foo<int>'$}} +// CHECK: {{^kind:[ ]+TemplateInstantiation$}} +// CHECK: {{^event:[ ]+Begin$}} +// CHECK: {{^orig:[ ]+'.*templight-default-func-arg.cpp:3:6'}} +// CHECK: {{^poi:[ ]+'.*templight-default-func-arg.cpp:72:3'$}} +// CHECK-LABEL: {{^---$}} +// CHECK: {{^name:[ ]+'foo<int>'$}} +// CHECK: {{^kind:[ ]+TemplateInstantiation$}} +// CHECK: {{^event:[ ]+End$}} +// CHECK: {{^orig:[ ]+'.*templight-default-func-arg.cpp:3:6'}} +// CHECK: {{^poi:[ ]+'.*templight-default-func-arg.cpp:72:3'$}} + foo<int>(); +} |

