• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
2// Check that the CHECK lines are generated before the definition and not the declaration
3// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu %s -emit-llvm -o - | FileCheck %s
4
5int foo(int arg);
6
7void empty_function(void);
8
9// CHECK-LABEL: @main(
10// CHECK-NEXT:  entry:
11// CHECK-NEXT:    [[RETVAL:%.*]] = alloca i32, align 4
12// CHECK-NEXT:    store i32 0, i32* [[RETVAL]], align 4
13// CHECK-NEXT:    call void @empty_function()
14// CHECK-NEXT:    [[CALL:%.*]] = call i32 @foo(i32 1)
15// CHECK-NEXT:    ret i32 [[CALL]]
16//
17int main() {
18  empty_function();
19  return foo(1);
20}
21
22// CHECK-LABEL: @foo(
23// CHECK-NEXT:  entry:
24// CHECK-NEXT:    [[ARG_ADDR:%.*]] = alloca i32, align 4
25// CHECK-NEXT:    store i32 [[ARG:%.*]], i32* [[ARG_ADDR]], align 4
26// CHECK-NEXT:    [[TMP0:%.*]] = load i32, i32* [[ARG_ADDR]], align 4
27// CHECK-NEXT:    ret i32 [[TMP0]]
28//
29int foo(int arg) {
30  return arg;
31}
32
33// CHECK-LABEL: @empty_function(
34// CHECK-NEXT:  entry:
35// CHECK-NEXT:    ret void
36//
37void empty_function(void) {}
38