49 lines · c
1// RUN: %clang_cc1 -triple i386-pc-linux-gnu -DBITCODE -emit-llvm-bc -o %t.bc %s2// RUN: %clang_cc1 -triple i386-pc-linux-gnu -DBITCODE2 -emit-llvm-bc -o %t-2.bc %s3// RUN: %clang_cc1 -triple i386-pc-linux-gnu -mlink-bitcode-file %t.bc \4// RUN: -O3 -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-NO-BC %s5// RUN: %clang_cc1 -triple i386-pc-linux-gnu -O3 -emit-llvm -o - \6// RUN: -mlink-bitcode-file %t.bc -mlink-bitcode-file %t-2.bc %s \7// RUN: | FileCheck -check-prefix=CHECK-NO-BC -check-prefix=CHECK-NO-BC2 %s8// RUN: not %clang_cc1 -triple i386-pc-linux-gnu -DBITCODE -O3 -emit-llvm -o - \9// RUN: -mlink-bitcode-file %t.bc %s 2>&1 | FileCheck -check-prefix=CHECK-BC %s10// Make sure we deal with failure to load the file.11// RUN: not %clang_cc1 -triple i386-pc-linux-gnu -mlink-bitcode-file no-such-file.bc \12// RUN: -emit-llvm -o - %s 2>&1 | FileCheck -check-prefix=CHECK-NO-FILE %s13 14// Make sure we can perform the same options if the input is LLVM-IR15// RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm-bc -o %t-in.bc %s16// RUN: %clang_cc1 -triple i386-pc-linux-gnu -mlink-bitcode-file %t.bc \17// RUN: -O3 -emit-llvm -o - %t-in.bc | FileCheck -check-prefix=CHECK-NO-BC %s18// RUN: %clang_cc1 -triple i386-pc-linux-gnu -O3 -emit-llvm -o - \19// RUN: -mlink-bitcode-file %t.bc -mlink-bitcode-file %t-2.bc %t-in.bc \20// RUN: | FileCheck -check-prefix=CHECK-NO-BC -check-prefix=CHECK-NO-BC2 %s21 22int f(void);23 24#ifdef BITCODE25 26extern int f2(void);27// CHECK-BC: fatal error: cannot link module {{.*}}'f': symbol multiply defined28int f(void) {29 f2();30 return 42;31}32 33#elif BITCODE234int f2(void) { return 43; }35#else36 37// CHECK-NO-BC-LABEL: define{{.*}} i32 @g38// CHECK-NO-BC: ret i32 4239int g(void) {40 return f();41}42 43// CHECK-NO-BC-LABEL: define{{.*}} i32 @f44// CHECK-NO-BC2-LABEL: define{{.*}} i32 @f245 46#endif47 48// CHECK-NO-FILE: fatal error: cannot open file 'no-such-file.bc'49