1 ! Tests for the `-save-temps` flag. As `flang` does not implement `-fc1as` (i.e. a driver for the integrated assembler), we need to
2 ! use `-fno-integrated-as` here.
4 ! UNSUPPORTED: system-windows
6 !--------------------------
7 ! Basic case: `-save-temps`
8 !--------------------------
9 ! RUN: %flang -save-temps -fno-integrated-as %s -### 2>&1 | FileCheck %s
10 ! CHECK: "-o" "save-temps.i"
11 ! CHECK-NEXT: "-o" "save-temps.bc"
12 ! CHECK-NEXT: "-o" "save-temps.s"
13 ! CHECK-NEXT: "-o" "save-temps.o"
14 ! CHECK-NEXT: "-o" "a.out"
16 !--------------------------
18 !--------------------------
19 ! This should work the same as -save-temps above
21 ! RUN: %flang -save-temps=cwd -fno-integrated-as %s -### 2>&1 | FileCheck %s -check-prefix=CWD
22 ! CWD: "-o" "save-temps.i"
23 ! CWD-NEXT: "-o" "save-temps.bc"
24 ! CWD-NEXT: "-o" "save-temps.s"
25 ! CWD-NEXT: "-o" "save-temps.o"
26 ! CWD-NEXT: "-o" "a.out"
28 !--------------------------
30 !--------------------------
31 ! Check that temp files are saved in the same directory as the output file
32 ! regardless of whether -o is specified.
34 ! RUN: %flang -save-temps=obj -fno-integrated-as -o obj/dir/a.out %s -### 2>&1 | FileCheck %s -check-prefix=CHECK-OBJ
35 ! CHECK-OBJ: "-o" "obj/dir/save-temps.i"
36 ! CHECK-OBJ-NEXT: "-o" "obj/dir/save-temps.bc"
37 ! CHECK-OBJ-NEXT: "-o" "obj/dir/save-temps.s"
38 ! CHECK-OBJ-NEXT: "-o" "obj/dir/save-temps.o"
39 ! CHECK-OBJ-NEXT: "-o" "obj/dir/a.out"
41 ! RUN: %flang -save-temps=obj -fno-integrated-as %s -### 2>&1 | FileCheck %s -check-prefix=CHECK-OBJ-NOO
42 ! CHECK-OBJ-NOO: "-o" "save-temps.i"
43 ! CHECK-OBJ-NOO-NEXT: "-o" "save-temps.bc"
44 ! CHECK-OBJ-NOO-NEXT: "-o" "save-temps.s"
45 ! CHECK-OBJ-NOO-NEXT: "-o" "save-temps.o"
46 ! CHECK-OBJ-NOO-NEXT: "-o" "a.out"
48 !--------------------------
49 ! `-S` without `-save-temps`
50 !--------------------------
51 ! Check for a single `flang -fc1` invocation when NOT using -save-temps.
52 ! RUN: %flang -S %s -### 2>&1 | FileCheck %s -check-prefix=NO-TEMPS
55 ! NO-TEMPS-SAME: "-o" "save-temps.s"