xref: /llvm-project/clang/test/CodeGenCXX/inline-template-hint.cpp (revision 9b36a9c8da1e22769ad9a46f7af9ff495b77bcc6)
1 // RUN: %clang_cc1 %s -std=c++11 -triple=x86_64-linux -O2 \
2 // RUN:   -finline-functions -emit-llvm -disable-llvm-passes -o - \
3 // RUN: | FileCheck -allow-deprecated-dag-overlap %s \
4 // RUN:   --check-prefix=CHECK --check-prefix=SUITABLE
5 // RUN: %clang_cc1 %s -std=c++11 -triple=x86_64-linux -O2 \
6 // RUN:   -finline-hint-functions -emit-llvm -disable-llvm-passes -o - \
7 // RUN: | FileCheck -allow-deprecated-dag-overlap %s \
8 // RUN:   --check-prefix=CHECK --check-prefix=HINTED
9 // RUN: %clang_cc1 %s -std=c++11 -triple=x86_64-linux -O2 \
10 // RUN:   -fno-inline -emit-llvm -disable-llvm-passes -o - \
11 // RUN: | FileCheck -allow-deprecated-dag-overlap %s \
12 // RUN:   --check-prefix=CHECK --check-prefix=NOINLINE
13 
14 struct A {
15   inline void int_run(int);
16 
17   template <class T>
18   inline void template_run(T);
19 };
20 
21 // CHECK: @_ZN1A7int_runEi({{.*}}) [[ATTR:#[0-9]+]]
int_run(int)22 void A::int_run(int) {}
23 // CHECK: @_ZN1A12template_runIiEEvT_({{.*}}) [[ATTR]]
24 template <typename T>
template_run(T)25 void A::template_run(T) {}
26 
bar()27 void bar() {
28   A().int_run(1);
29   A().template_run(1);
30 }
31 
32 // SUITABLE: attributes [[ATTR]] = { {{.*}}inlinehint{{.*}} }
33 //   HINTED: attributes [[ATTR]] = { {{.*}}inlinehint{{.*}} }
34 // NOINLINE: attributes [[ATTR]] = { {{.*}}noinline{{.*}} }
35