xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGen/link-bitcode-file.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple i386-pc-linux-gnu -DBITCODE -emit-llvm-bc -o %t.bc %s
2f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple i386-pc-linux-gnu -mlink-bitcode-file %t.bc -O3 -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-NO-BC %s
3f4a2713aSLionel Sambuc // RUN: not %clang_cc1 -triple i386-pc-linux-gnu -DBITCODE -mlink-bitcode-file %t.bc -O3 -emit-llvm -o - %s 2>&1 | FileCheck -check-prefix=CHECK-BC %s
4f4a2713aSLionel Sambuc 
5f4a2713aSLionel Sambuc int f(void);
6f4a2713aSLionel Sambuc 
7f4a2713aSLionel Sambuc #ifdef BITCODE
8f4a2713aSLionel Sambuc 
9*0a6a1f1dSLionel Sambuc // CHECK-BC: fatal error: cannot link module {{.*}}'f': symbol multiply defined
f(void)10f4a2713aSLionel Sambuc int f(void) {
11f4a2713aSLionel Sambuc   return 42;
12f4a2713aSLionel Sambuc }
13f4a2713aSLionel Sambuc 
14f4a2713aSLionel Sambuc #else
15f4a2713aSLionel Sambuc 
16f4a2713aSLionel Sambuc // CHECK-NO-BC-LABEL: define i32 @g
17f4a2713aSLionel Sambuc // CHECK-NO-BC: ret i32 42
g(void)18f4a2713aSLionel Sambuc int g(void) {
19f4a2713aSLionel Sambuc   return f();
20f4a2713aSLionel Sambuc }
21f4a2713aSLionel Sambuc 
22f4a2713aSLionel Sambuc // CHECK-NO-BC-LABEL: define i32 @f
23f4a2713aSLionel Sambuc 
24f4a2713aSLionel Sambuc #endif
25