llvm-project/clang/test/CodeGen/debug-info-block-vars.c
Aaron Ballman ed509fe296 Use functions with prototypes when appropriate; NFC
A significant number of our tests in C accidentally use functions
without prototypes. This patch converts the function signatures to have
a prototype for the situations where the test is not specific to K&R C
declarations. e.g.,

  void func();

becomes

  void func(void);

This is the tenth batch of tests being updated (there are a
significant number of other tests left to be updated).
2022-02-15 09:28:02 -05:00

21 lines
970 B
C

// RUN: %clang_cc1 -x c -fblocks -debug-info-kind=standalone -emit-llvm -O0 \
// RUN: -triple x86_64-apple-darwin -o - %s | FileCheck %s
// RUN: %clang_cc1 -x c -fblocks -debug-info-kind=standalone -emit-llvm -O1 \
// RUN: -triple x86_64-apple-darwin -o - %s \
// RUN: | FileCheck --check-prefix=CHECK-OPT %s
// CHECK: define internal void @__f_block_invoke(i8* noundef %.block_descriptor)
// CHECK: %.block_descriptor.addr = alloca i8*, align 8
// CHECK: %block.addr = alloca <{ i8*, i32, i32, i8*, %struct.__block_descriptor* }>*, align 8
// CHECK: store i8* %.block_descriptor, i8** %.block_descriptor.addr, align 8
// CHECK: call void @llvm.dbg.declare(metadata i8** %.block_descriptor.addr,
// CHECK-SAME: metadata !DIExpression())
// CHECK-OPT-NOT: alloca
// CHECK-OPT: call void @llvm.dbg.value(metadata i8* %.block_descriptor,
// CHECK-OPT-SAME: metadata !DIExpression())
void f(void) {
a(^{
b();
});
}