xref: /minix/external/bsd/llvm/dist/clang/test/Driver/lto.c (revision 83133719)
1 // -flto causes a switch to llvm-bc object files.
2 // RUN: %clang -ccc-print-phases -c %s -flto 2> %t.log
3 // RUN: grep '2: compiler, {1}, lto-bc' %t.log
4 
5 // RUN: %clang -ccc-print-phases %s -flto 2> %t.log
6 // RUN: grep '0: input, ".*lto.c", c' %t.log
7 // RUN: grep '1: preprocessor, {0}, cpp-output' %t.log
8 // RUN: grep '2: compiler, {1}, lto-bc' %t.log
9 // RUN: grep '3: linker, {2}, image' %t.log
10 
11 // llvm-bc and llvm-ll outputs need to match regular suffixes
12 // (unfortunately).
13 // RUN: %clang %s -flto -save-temps -### 2> %t.log
14 // RUN: grep '"-o" ".*lto\.i" "-x" "c" ".*lto\.c"' %t.log
15 // RUN: grep '"-o" ".*lto\.o" .*".*lto\.i"' %t.log
16 // RUN: grep '".*a.out" .*".*lto\.o"' %t.log
17 
18 // RUN: %clang %s -flto -S -### 2> %t.log
19 // RUN: grep '"-o" ".*lto\.s" "-x" "c" ".*lto\.c"' %t.log
20 
21 // RUN: not %clang %s -emit-llvm 2>&1 | FileCheck --check-prefix=LLVM-LINK %s
22 // LLVM-LINK: -emit-llvm cannot be used when linking
23