Clang Project

clang_source_code/test/CodeGenCXX/inline-template-hint.cpp
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
14struct 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]+]]
22void A::int_run(int) {}
23// CHECK: @_ZN1A12template_runIiEEvT_({{.*}}) [[ATTR]]
24template <typename T>
25void A::template_run(T) {}
26
27void 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