llvm-capstone/clang/test/Frontend/embed-bitcode-noopt.c
Aaron Ballman 7de7161304 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 sixth batch of tests being updated (there are a significant
number of other tests left to be updated).
2022-02-09 17:16:10 -05:00

31 lines
990 B
C

// Ensure calling bypassing the driver with -fembed-bitcode embeds bitcode pre-
// optimizations
// REQUIRES: x86-registered-target
// RUN: %clang_cc1 %s -O2 -emit-obj -triple=x86_64-unknown-linux-gnu -o %t.o -fembed-bitcode=all
// RUN: llvm-objcopy --dump-section=.llvmbc=%t.bc %t.o /dev/null
// Also check that the .llvmcmd section captures the optimization options.
// RUN: llvm-dis %t.bc -o - | FileCheck %s --check-prefix=CHECK-BC
// RUN: llvm-objcopy --dump-section=.llvmcmd=- %t.o /dev/null | FileCheck %s --check-prefix=CHECK-CMD
// CHECK-BC-LABEL: define{{.*}} void @bar() #0 {
// CHECK-BC-NEXT: entry:
// CHECK-BC-NEXT: ret void
// CHECK-BC-NEXT: }
// CHECK-BC-LABEL: define{{.*}} void @foo() #1 {
// CHECK-BC-NEXT: entry:
// CHECK-BC-NEXT: call void @bar()
// CHECK-BC-NEXT: ret void
// CHECK-BC-NEXT: }
// CHECK-BC-LABEL: attributes #0 = {{.*}} alwaysinline
// CHECK-CMD: -O2
__attribute__((always_inline)) void bar(void) {
return;
}
void foo(void) {
bar();
return;
}