| 1 |
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --include-generated-funcs --version 5 |
| 2 |
// Basic C++ test for update_cc_test_checks |
| 3 |
// RUN: %clang_cc1 -triple=x86_64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s |
| 4 |
// RUN: %clang_cc1 -triple=x86_64-apple-macho -emit-llvm -o - %s | FileCheck %s --check-prefix=MACHO |
| 5 |
// RUN: %clang_cc1 -triple=x86_64-windows-msvc -emit-llvm -o - %s | FileCheck %s --check-prefix=MSVC |
| 6 |
// RUN: %clang_cc1 -triple=x86_64-windows-gnu -emit-llvm -o - %s | FileCheck %s --check-prefix=MINGW |
| 7 |
|
| 8 |
class Foo { |
| 9 |
int x; |
| 10 |
|
| 11 |
public: |
| 12 |
explicit Foo(int x); |
| 13 |
~Foo(); |
| 14 |
inline int function_defined_inline(int arg) const { |
| 15 |
return arg + x; |
| 16 |
} |
| 17 |
inline int function_defined_out_of_line(int arg) const; |
| 18 |
}; |
| 19 |
|
| 20 |
[[clang::noinline]] static int static_noinline_fn(int arg) { return arg; } |
| 21 |
|
| 22 |
Foo::Foo(int x) : x(x) {} |
| 23 |
Foo::~Foo() {} |
| 24 |
int Foo::function_defined_out_of_line(int arg) const { return x - arg; } |
| 25 |
|
| 26 |
// Call the inline methods to ensure the LLVM IR is generated: |
| 27 |
int main() { |
| 28 |
Foo f(1); |
| 29 |
f.function_defined_inline(2); |
| 30 |
f.function_defined_out_of_line(3); |
| 31 |
return static_noinline_fn(0); |
| 32 |
} |