1 // REQUIRES: x86-registered-target
3 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -o - -emit-interface-stubs %s | FileCheck %s
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
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
13 // RUN: %clang -target x86_64-unknown-linux-gnu -o - -c %s | llvm-nm - 2>&1 | count 0
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
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
23 // CHECK-NOT: _Z16templateFunctionIiET_S0_
24 // CHECK-USES-TEMPLATE-FUNCTION-DAG: _Z16templateFunctionIiET_S0_
25 // CHECK-SPECIALIZES-TEMPLATE-FUNCTION-DAG: _Z16templateFunctionIiET_S0_
27 T
templateFunction(T t
) { return t
; }
29 #ifdef USE_TEMPLATE_FUNCTION
30 int FortyTwo
= templateFunction
<int>(42);
33 #ifdef SPECIALIZE_TEMPLATE_FUNCTION
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); }