Debian Codegraph @

clang/test/utils/update_cc_test_checks/Inputs/def-and-decl.c.expected

raw
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
5 int foo(int arg);
6
7 void 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, ptr [[RETVAL]], align 4
13 // CHECK-NEXT: call void @empty_function()
14 // CHECK-NEXT: [[CALL:%.*]] = call i32 @foo(i32 noundef 1)
15 // CHECK-NEXT: ret i32 [[CALL]]
16 //
17 int main(void) {
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:%.*]], ptr [[ARG_ADDR]], align 4
26 // CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[ARG_ADDR]], align 4
27 // CHECK-NEXT: ret i32 [[TMP0]]
28 //
29 int foo(int arg) {
30 return arg;
31 }
32
33 // CHECK-LABEL: @empty_function(
34 // CHECK-NEXT: entry:
35 // CHECK-NEXT: ret void
36 //
37 void empty_function(void) {}