• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Basic C++ test for update_cc_test_checks
2 // RUN: %clang_cc1 -triple=x86_64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s
3 
4 class Foo {
5   int x;
6 
7 public:
8   explicit Foo(int x);
9   ~Foo();
function_defined_inline(int arg) const10   inline int function_defined_inline(int arg) const {
11     return arg + x;
12   }
13   inline int function_defined_out_of_line(int arg) const;
14 };
15 
Foo(int x)16 Foo::Foo(int x) : x(x) {}
~Foo()17 Foo::~Foo() {}
function_defined_out_of_line(int arg) const18 int Foo::function_defined_out_of_line(int arg) const { return x - arg; }
19 
20 // Call the inline methods to ensure the LLVM IR is generated:
main()21 int main() {
22   Foo f(1);
23   f.function_defined_inline(2);
24   f.function_defined_out_of_line(3);
25 }
26