diff options
author | Andrew V. Tischenko <andrew.v.tischenko@gmail.com> | 2018-04-10 10:34:13 +0000 |
---|---|---|
committer | Andrew V. Tischenko <andrew.v.tischenko@gmail.com> | 2018-04-10 10:34:13 +0000 |
commit | c88deb100f1d4a1d14dbcc42de01d325919ebec6 (patch) | |
tree | 36fe084ef5681b5e643f8eb90483a14f00df70d4 /clang/test/Frontend/ftime-report-template-decl.cpp | |
parent | 037d3b20d3c0d9ea5c90aec9de3a5257d46b70c9 (diff) | |
download | bcm5719-llvm-c88deb100f1d4a1d14dbcc42de01d325919ebec6.tar.gz bcm5719-llvm-c88deb100f1d4a1d14dbcc42de01d325919ebec6.zip |
-ftime-report switch support in Clang.
The current support of the feature produces only 2 lines in report:
-Some general Code Generation Time;
-Total time of Backend Consumer actions.
This patch extends Clang time report with new lines related to Preprocessor, Include Filea Search, Parsing, etc.
Differential Revision: https://reviews.llvm.org/D43578
llvm-svn: 329684
Diffstat (limited to 'clang/test/Frontend/ftime-report-template-decl.cpp')
-rw-r--r-- | clang/test/Frontend/ftime-report-template-decl.cpp | 147 |
1 files changed, 147 insertions, 0 deletions
diff --git a/clang/test/Frontend/ftime-report-template-decl.cpp b/clang/test/Frontend/ftime-report-template-decl.cpp new file mode 100644 index 00000000000..311358af18b --- /dev/null +++ b/clang/test/Frontend/ftime-report-template-decl.cpp @@ -0,0 +1,147 @@ +// RUN: %clang %s -S -o - -ftime-report 2>&1 | FileCheck %s +// RUN: %clang %s -S -o - -fdelayed-template-parsing -DDELAYED_TEMPLATE_PARSING -ftime-report 2>&1 | FileCheck %s + +// Template function declarations +template <typename T> +void foo(); +template <typename T, typename U> +void foo(); + +// Template function definitions. +template <typename T> +void foo() {} + +// Template class (forward) declarations +template <typename T> +struct A; +template <typename T, typename U> +struct b; +template <typename> +struct C; +template <typename, typename> +struct D; + +// Forward declarations with default parameters? +template <typename T = int> +class X1; +template <typename = int> +class X2; + +// Forward declarations w/template template parameters +template <template <typename> class T> +class TTP1; +template <template <typename> class> +class TTP2; +template <template <typename X, typename Y> class T> +class TTP5; + +// Forward declarations with non-type params +template <int> +class NTP0; +template <int N> +class NTP1; +template <int N = 5> +class NTP2; +template <int = 10> +class NTP3; +template <unsigned int N = 12u> +class NTP4; +template <unsigned int = 12u> +class NTP5; +template <unsigned = 15u> +class NTP6; +template <typename T, T Obj> +class NTP7; + +// Template class declarations +template <typename T> +struct A {}; +template <typename T, typename U> +struct B {}; + +namespace PR6184 { +namespace N { +template <typename T> +void bar(typename T::x); +} + +template <typename T> +void N::bar(typename T::x) {} +} + +// This PR occurred only in template parsing mode. +namespace PR17637 { +template <int> +struct L { + template <typename T> + struct O { + template <typename U> + static void Fun(U); + }; +}; + +template <int k> +template <typename T> +template <typename U> +void L<k>::O<T>::Fun(U) {} + +void Instantiate() { L<0>::O<int>::Fun(0); } +} + +namespace explicit_partial_specializations { +typedef char (&oneT)[1]; +typedef char (&twoT)[2]; +typedef char (&threeT)[3]; +typedef char (&fourT)[4]; +typedef char (&fiveT)[5]; +typedef char (&sixT)[6]; + +char one[1]; +char two[2]; +char three[3]; +char four[4]; +char five[5]; +char six[6]; + +template <bool b> +struct bool_ { typedef int type; }; +template <> +struct bool_<false> {}; + +#define XCAT(x, y) x##y +#define CAT(x, y) XCAT(x, y) +#define sassert(_b_) bool_<(_b_)>::type CAT(var, __LINE__); + +template <int> +struct L { + template <typename T> + struct O { + template <typename U> + static oneT Fun(U); + }; +}; +template <int k> +template <typename T> +template <typename U> +oneT L<k>::O<T>::Fun(U) { return one; } + +template <> +template <> +template <typename U> +oneT L<0>::O<char>::Fun(U) { return one; } + +void Instantiate() { + sassert(sizeof(L<0>::O<int>::Fun(0)) == sizeof(one)); + sassert(sizeof(L<0>::O<char>::Fun(0)) == sizeof(one)); +} +} + +// CHECK: ===== Clang Parser ===== +// CHECK: ---User Time--- --User+System-- ---Wall Time--- --- Name --- +// CHECK: Parse Top Level Decl +// CHECK: Parse Template +// CHECK: Parse Function Definition +// CHECK: PP Append Macro +// CHECK: Scope manipulation +// CHECK: PP Find Handler +// CHECK: Total |