2019-06-21 02:28:21 +08:00
|
|
|
// REQUIRES: x86-registered-target
|
2019-10-08 23:23:14 +08:00
|
|
|
|
2019-11-14 12:58:09 +08:00
|
|
|
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -o - -emit-interface-stubs %s | FileCheck %s
|
2019-06-21 00:59:48 +08:00
|
|
|
|
2019-11-14 12:58:09 +08:00
|
|
|
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -o - -emit-interface-stubs \
|
2019-06-21 00:59:48 +08:00
|
|
|
// RUN: -DUSE_TEMPLATE_FUNCTION=1 %s | \
|
|
|
|
// RUN: FileCheck -check-prefix=CHECK-USES-TEMPLATE-FUNCTION %s
|
|
|
|
|
2019-11-14 12:58:09 +08:00
|
|
|
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -o - -emit-interface-stubs \
|
2019-06-21 00:59:48 +08:00
|
|
|
// RUN: -DSPECIALIZE_TEMPLATE_FUNCTION=1 %s | \
|
|
|
|
// RUN: FileCheck -check-prefix=CHECK-SPECIALIZES-TEMPLATE-FUNCTION %s
|
|
|
|
|
2020-01-18 02:04:00 +08:00
|
|
|
// RUN: %clang -target x86_64-unknown-linux-gnu -o - -c %s | llvm-nm - 2>&1 | count 0
|
2019-06-21 00:59:48 +08:00
|
|
|
|
|
|
|
// RUN: %clang -target x86_64-unknown-linux-gnu -o - -c \
|
|
|
|
// RUN: -DUSE_TEMPLATE_FUNCTION=1 %s | llvm-nm - 2>&1 | \
|
|
|
|
// RUN: FileCheck -check-prefix=CHECK-USES-TEMPLATE-FUNCTION %s
|
|
|
|
|
|
|
|
// RUN: %clang -target x86_64-unknown-linux-gnu -o - -c \
|
|
|
|
// RUN: -DSPECIALIZE_TEMPLATE_FUNCTION=1 %s | llvm-nm - 2>&1 | \
|
|
|
|
// RUN: FileCheck -check-prefix=CHECK-SPECIALIZES-TEMPLATE-FUNCTION %s
|
|
|
|
|
|
|
|
// CHECK-NOT: _Z16templateFunctionIiET_S0_
|
|
|
|
// CHECK-USES-TEMPLATE-FUNCTION-DAG: _Z16templateFunctionIiET_S0_
|
|
|
|
// CHECK-SPECIALIZES-TEMPLATE-FUNCTION-DAG: _Z16templateFunctionIiET_S0_
|
|
|
|
template <typename T>
|
|
|
|
T templateFunction(T t) { return t; }
|
|
|
|
|
|
|
|
#ifdef USE_TEMPLATE_FUNCTION
|
|
|
|
int FortyTwo = templateFunction<int>(42);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef SPECIALIZE_TEMPLATE_FUNCTION
|
|
|
|
template <>
|
|
|
|
int templateFunction<int>(int t);
|
|
|
|
// TODO: Make it so that -emit-interface-stubs does not emit
|
|
|
|
// _Z16templateFunctionIiET_S0_ if there is no user of the specialization.
|
|
|
|
int foo() { return templateFunction(42); }
|
|
|
|
#endif
|