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