[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / test / Driver / save-temps.c
bloba26ba9f4ec0d3670e7753900c53f11aa4d9f0bdc
1 // REQUIRES: x86-registered-target
2 // REQUIRES: arm-registered-target
4 // RUN: %clang -target x86_64-apple-darwin -save-temps -arch x86_64 %s -### 2>&1 \
5 // RUN: | FileCheck %s
6 // CHECK: "-o" "save-temps.i"
7 // CHECK: "-emit-llvm-uselists"
8 // CHECK: "-disable-llvm-passes"
9 // CHECK: "-o" "save-temps.bc"
10 // CHECK: "-o" "save-temps.s"
11 // CHECK: "-o" "save-temps.o"
12 // CHECK: "-o" "a.out"
14 // Check -save-temps=cwd which should work the same as -save-temps above
16 // RUN: %clang -target x86_64-apple-darwin -save-temps=cwd -arch x86_64 %s -### 2>&1 \
17 // RUN: | FileCheck %s -check-prefix=CWD
18 // CWD: "-o" "save-temps.i"
19 // CWD: "-emit-llvm-uselists"
20 // CWD: "-disable-llvm-passes"
21 // CWD: "-o" "save-temps.bc"
22 // CWD: "-o" "save-temps.s"
23 // CWD: "-o" "save-temps.o"
24 // CWD: "-o" "a.out"
26 // Check for a single clang cc1 invocation when NOT using -save-temps.
27 // RUN: %clang -target x86_64-apple-darwin -arch x86_64 -S %s -### 2>&1 \
28 // RUN: | FileCheck %s -check-prefix=NO-TEMPS
29 // NO-TEMPS: "-cc1"
30 // NO-TEMPS: "-S"
31 // NO-TEMPS: "-x" "c"
33 // RUN: %clang -target x86_64-apple-darwin -save-temps -arch i386 -arch x86_64 %s -### 2>&1 \
34 // RUN: | FileCheck %s -check-prefix=MULT-ARCH
35 // MULT-ARCH: "-o" "save-temps-i386.i"
36 // MULT-ARCH: "-o" "save-temps-i386.bc"
37 // MULT-ARCH: "-o" "save-temps-i386.s"
38 // MULT-ARCH: "-o" "save-temps-i386.o"
39 // MULT-ARCH: "-o" "a.out-i386"
40 // MULT-ARCH: "-o" "save-temps-x86_64.i"
41 // MULT-ARCH: "-o" "save-temps-x86_64.bc"
42 // MULT-ARCH: "-o" "save-temps-x86_64.s"
43 // MULT-ARCH: "-o" "save-temps-x86_64.o"
44 // MULT-ARCH: "-o" "a.out-x86_64"
45 // MULT-ARCH: lipo
46 // MULT-ARCH: "-create" "-output" "a.out" "a.out-i386" "a.out-x86_64"
48 // RUN: %clang -target x86_64-apple-darwin -save-temps=cwd -arch i386 -arch x86_64 %s -### 2>&1 \
49 // RUN: | FileCheck %s -check-prefix=MULT-ARCH-CWD
50 // MULT-ARCH-CWD: "-o" "save-temps-i386.i"
51 // MULT-ARCH-CWD: "-o" "save-temps-i386.bc"
52 // MULT-ARCH-CWD: "-o" "save-temps-i386.s"
53 // MULT-ARCH-CWD: "-o" "save-temps-i386.o"
54 // MULT-ARCH-CWD: "-o" "a.out-i386"
55 // MULT-ARCH-CWD: "-o" "save-temps-x86_64.i"
56 // MULT-ARCH-CWD: "-o" "save-temps-x86_64.bc"
57 // MULT-ARCH-CWD: "-o" "save-temps-x86_64.s"
58 // MULT-ARCH-CWD: "-o" "save-temps-x86_64.o"
59 // MULT-ARCH-CWD: "-o" "a.out-x86_64"
60 // MULT-ARCH-CWD: lipo
61 // MULT-ARCH-CWD: "-create" "-output" "a.out" "a.out-i386" "a.out-x86_64"
63 // Check that temp files are saved in the same directory as the output file
64 // regardless of whether -o is specified.
66 // RUN: %clang -target x86_64-apple-darwin -save-temps=obj -o obj/dir/a.out -arch x86_64 %s -### 2>&1 \
67 // RUN: | FileCheck %s -check-prefix=CHECK-OBJ
68 // CHECK-OBJ: "-o" "obj/dir{{/|\\\\}}save-temps.i"
69 // CHECK-OBJ: "-disable-llvm-passes"
70 // CHECK-OBJ: "-o" "obj/dir{{/|\\\\}}save-temps.bc"
71 // CHECK-OBJ: "-o" "obj/dir{{/|\\\\}}save-temps.s"
72 // CHECK-OBJ: "-o" "obj/dir{{/|\\\\}}save-temps.o"
73 // CHECK-OBJ: "-o" "obj/dir{{/|\\\\}}a.out"
75 // RUN: %clang -target x86_64-apple-darwin -save-temps=obj -arch x86_64 %s -### 2>&1 \
76 // RUN: | FileCheck %s -check-prefix=CHECK-OBJ-NOO
77 // CHECK-OBJ-NOO: "-o" "save-temps.i"
78 // CHECK-OBJ-NOO: "-disable-llvm-passes"
79 // CHECK-OBJ-NOO: "-o" "save-temps.bc"
80 // CHECK-OBJ-NOO: "-o" "save-temps.s"
81 // CHECK-OBJ-NOO: "-o" "save-temps.o"
82 // CHECK-OBJ-NOO: "-o" "a.out"
84 // RUN: %clang -target i386-unknown-freebsd -save-temps -g -c %s -### 2>&1 \
85 // RUN: | FileCheck %s -check-prefix=CHECK-SAVE-TEMPS
86 // CHECK-SAVE-TEMPS: "-cc1as"
87 // CHECK-SAVE-TEMPS: "-dwarf-version={{.}}"
89 // RUN: %clang --target=arm-arm-none-eabi -march=armv8-m.main -mcmse -save-temps -c -v %s -### 2>&1 \
90 // RUN: | FileCheck %s -check-prefix=CHECK-SAVE-TEMPS-CMSE
91 // RUN: %clang --target=arm-arm-none-eabi -march=armv8-m.main -mcmse -x assembler -c -v %s -### 2>&1 \
92 // RUN: | FileCheck %s -check-prefix=CHECK-SAVE-TEMPS-CMSE
93 // CHECK-SAVE-TEMPS-CMSE: -cc1as
94 // CHECK-SAVE-TEMPS-CMSE: +8msecext
95 // CHECK-SAVE-TEMPS-CMSE-NOT: '+cmse' is not a recognized feature for this target (ignoring feature)