150
|
1 // REQUIRES: x86-registered-target
|
|
2
|
|
3 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -o - -emit-interface-stubs %s | FileCheck %s
|
|
4
|
|
5 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -o - -emit-interface-stubs \
|
|
6 // RUN: -DUSE_TEMPLATE_FUNCTION=1 %s | \
|
|
7 // RUN: FileCheck -check-prefix=CHECK-USES-TEMPLATE-FUNCTION %s
|
|
8
|
|
9 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -o - -emit-interface-stubs \
|
|
10 // RUN: -DSPECIALIZE_TEMPLATE_FUNCTION=1 %s | \
|
|
11 // RUN: FileCheck -check-prefix=CHECK-SPECIALIZES-TEMPLATE-FUNCTION %s
|
|
12
|
|
13 // RUN: %clang -target x86_64-unknown-linux-gnu -o - -c %s | llvm-nm - 2>&1 | count 0
|
|
14
|
|
15 // RUN: %clang -target x86_64-unknown-linux-gnu -o - -c \
|
|
16 // RUN: -DUSE_TEMPLATE_FUNCTION=1 %s | llvm-nm - 2>&1 | \
|
|
17 // RUN: FileCheck -check-prefix=CHECK-USES-TEMPLATE-FUNCTION %s
|
|
18
|
|
19 // RUN: %clang -target x86_64-unknown-linux-gnu -o - -c \
|
|
20 // RUN: -DSPECIALIZE_TEMPLATE_FUNCTION=1 %s | llvm-nm - 2>&1 | \
|
|
21 // RUN: FileCheck -check-prefix=CHECK-SPECIALIZES-TEMPLATE-FUNCTION %s
|
|
22
|
|
23 // CHECK-NOT: _Z16templateFunctionIiET_S0_
|
|
24 // CHECK-USES-TEMPLATE-FUNCTION-DAG: _Z16templateFunctionIiET_S0_
|
|
25 // CHECK-SPECIALIZES-TEMPLATE-FUNCTION-DAG: _Z16templateFunctionIiET_S0_
|
|
26 template <typename T>
|
|
27 T templateFunction(T t) { return t; }
|
|
28
|
|
29 #ifdef USE_TEMPLATE_FUNCTION
|
|
30 int FortyTwo = templateFunction<int>(42);
|
|
31 #endif
|
|
32
|
|
33 #ifdef SPECIALIZE_TEMPLATE_FUNCTION
|
|
34 template <>
|
|
35 int templateFunction<int>(int t);
|
|
36 // TODO: Make it so that -emit-interface-stubs does not emit
|
|
37 // _Z16templateFunctionIiET_S0_ if there is no user of the specialization.
|
|
38 int foo() { return templateFunction(42); }
|
|
39 #endif
|