Index: clang/lib/Driver/Driver.cpp =================================================================== --- clang/lib/Driver/Driver.cpp +++ clang/lib/Driver/Driver.cpp @@ -5565,9 +5565,8 @@ } } else { if (MultipleArchs && !BoundArch.empty()) { - TmpName = GetTemporaryDirectory(Prefix); - llvm::sys::path::append(TmpName, - Twine(Prefix) + "-" + BoundArch + "." + Suffix); + TmpName = + GetTemporaryPath((Twine(Prefix) + "-" + BoundArch).str(), Suffix); } else { TmpName = GetTemporaryPath(Prefix, Suffix); } Index: clang/test/Driver/darwin-dsymutil.c =================================================================== --- clang/test/Driver/darwin-dsymutil.c +++ clang/test/Driver/darwin-dsymutil.c @@ -48,17 +48,17 @@ // RUN: -arch x86_64 -arch arm64 -ccc-print-bindings %s 2> %t // RUN: FileCheck --check-prefix=CHECK-MULTIARCH-OUTPUT-NAME < %t %s // -// CHECK-MULTIARCH-OUTPUT-NAME: "x86_64-apple-darwin11" - "darwin::Linker", inputs: ["{{.*}}{{/|\\}}darwin-dsymutil-x86_64.o"], output: "{{.*}}{{/|\\}}darwin-dsymutil-x86_64.out" -// CHECK-MULTIARCH-OUTPUT-NAME: "arm64-apple-darwin11" - "darwin::Linker", inputs: ["{{.*}}{{/|\\}}darwin-dsymutil-arm64.o"], output: "{{.*}}{{/|\\}}darwin-dsymutil-arm64.out" -// CHECK-MULTIARCH-OUTPUT-NAME: "arm64-apple-darwin11" - "darwin::Lipo", inputs: ["{{.*}}{{/|\\}}darwin-dsymutil-x86_64.out", "{{.*}}{{/|\\}}darwin-dsymutil-arm64.out"], output: "a.out" +// CHECK-MULTIARCH-OUTPUT-NAME: "x86_64-apple-darwin11" - "darwin::Linker", inputs: ["{{.*}}{{/|\\}}darwin-dsymutil-x86_64{{.*}}.o"], output: "{{.*}}{{/|\\}}darwin-dsymutil-x86_64{{.*}}.out" +// CHECK-MULTIARCH-OUTPUT-NAME: "arm64-apple-darwin11" - "darwin::Linker", inputs: ["{{.*}}{{/|\\}}darwin-dsymutil-arm64{{.*}}.o"], output: "{{.*}}{{/|\\}}darwin-dsymutil-arm64{{.*}}.out" +// CHECK-MULTIARCH-OUTPUT-NAME: "arm64-apple-darwin11" - "darwin::Lipo", inputs: ["{{.*}}{{/|\\}}darwin-dsymutil-x86_64{{.*}}.out", "{{.*}}{{/|\\}}darwin-dsymutil-arm64{{.*}}.out"], output: "a.out" // // RUN: %clang -target x86_64-apple-darwin11 \ // RUN: -Wl,-foo -arch x86_64 -arch arm64 -ccc-print-bindings %s 2> %t // RUN: FileCheck --check-prefix=CHECK-MULTIARCH-OUTPUT-NAME-WITH-ARG < %t %s // -// CHECK-MULTIARCH-OUTPUT-NAME-WITH-ARG: "x86_64-apple-darwin11" - "darwin::Linker", inputs: [(input arg), "{{.*}}{{/|\\}}darwin-dsymutil-x86_64.o"], output: "{{.*}}{{/|\\}}darwin-dsymutil-x86_64.out" -// CHECK-MULTIARCH-OUTPUT-NAME-WITH-ARG: "arm64-apple-darwin11" - "darwin::Linker", inputs: [(input arg), "{{.*}}{{/|\\}}darwin-dsymutil-arm64.o"], output: "{{.*}}{{/|\\}}darwin-dsymutil-arm64.out" -// CHECK-MULTIARCH-OUTPUT-NAME-WITH-ARG: "arm64-apple-darwin11" - "darwin::Lipo", inputs: ["{{.*}}{{/|\\}}darwin-dsymutil-x86_64.out", "{{.*}}{{/|\\}}darwin-dsymutil-arm64.out"], output: "a.out" +// CHECK-MULTIARCH-OUTPUT-NAME-WITH-ARG: "x86_64-apple-darwin11" - "darwin::Linker", inputs: [(input arg), "{{.*}}{{/|\\}}darwin-dsymutil-x86_64{{.*}}.o"], output: "{{.*}}{{/|\\}}darwin-dsymutil-x86_64{{.*}}.out" +// CHECK-MULTIARCH-OUTPUT-NAME-WITH-ARG: "arm64-apple-darwin11" - "darwin::Linker", inputs: [(input arg), "{{.*}}{{/|\\}}darwin-dsymutil-arm64{{.*}}.o"], output: "{{.*}}{{/|\\}}darwin-dsymutil-arm64{{.*}}.out" +// CHECK-MULTIARCH-OUTPUT-NAME-WITH-ARG: "arm64-apple-darwin11" - "darwin::Lipo", inputs: ["{{.*}}{{/|\\}}darwin-dsymutil-x86_64{{.*}}.out", "{{.*}}{{/|\\}}darwin-dsymutil-arm64{{.*}}.out"], output: "a.out" // Check that we only use dsymutil when needed. // Index: clang/test/Driver/hip-link-bc-to-bc.hip =================================================================== --- clang/test/Driver/hip-link-bc-to-bc.hip +++ clang/test/Driver/hip-link-bc-to-bc.hip @@ -11,10 +11,10 @@ // RUN: 2>&1 | FileCheck -check-prefix=BITCODE %s // BITCODE: "{{.*}}clang-offload-bundler" "-type=bc" "-targets=host-x86_64-unknown-linux-gnu,hip-amdgcn-amd-amdhsa-gfx906" "-input={{.*}}bundle1.bc" "-output=[[B1HOST:.*\.bc]]" "-output=[[B1DEV1:.*\.bc]]" "-unbundle" "-allow-missing-bundles" -// BITCODE: "{{.*}}clang{{.*}}" "-o" "[[B1DEV2:.*bundle1-gfx906.bc]]" "-x" "ir" "[[B1DEV1]]" +// BITCODE: "{{.*}}clang{{.*}}" "-o" "[[B1DEV2:.*bundle1-gfx906-.*\.bc]]" "-x" "ir" "[[B1DEV1]]" // BITCODE: "{{.*}}clang-offload-bundler" "-type=bc" "-targets=host-x86_64-unknown-linux-gnu,hip-amdgcn-amd-amdhsa-gfx906" "-input={{.*}}bundle2.bc" "-output=[[B2HOST:.*\.bc]]" "-output=[[B2DEV1:.*\.bc]]" "-unbundle" "-allow-missing-bundles" -// BITCODE: "{{.*}}clang{{.*}}" "-o" "[[B2DEV2:.*bundle2-gfx906.bc]]" "-x" "ir" "[[B2DEV1]]" +// BITCODE: "{{.*}}clang{{.*}}" "-o" "[[B2DEV2:.*bundle2-gfx906-.*\.bc]]" "-x" "ir" "[[B2DEV1]]" // BITCODE: "{{.*}}llvm-link" "-o" "bundle1-hip-amdgcn-amd-amdhsa-gfx906.bc" "[[B1DEV2]]" "[[B2DEV2]]" Index: clang/test/Driver/hip-temps-linux.hip =================================================================== --- /dev/null +++ clang/test/Driver/hip-temps-linux.hip @@ -0,0 +1,17 @@ +// REQUIRES: x86-registered-target +// REQUIRES: amdgpu-registered-target +// REQUIRES: system-linux + +// Check no temporary files or directores are left after compilation. +// RUN: rm -rf %t/mytmp +// RUN: mkdir -p %t/mytmp +// RUN: env TMPDIR=%t/mytmp %clang --target=x86_64-linux-gnu -nogpulib -nogpuinc \ +// RUN: --rocm-path=%S/Inputs/rocm -no-hip-rt --offload-arch=gfx1030 -v %s 2>&1 | \ +// RUN: FileCheck -check-prefixes=CHECK %s +// RUN: ls %t/mytmp >%t/mytmp.txt 2>&1 +// RUN: touch %t/empty.txt +// RUN: diff %t/mytmp.txt %t/empty.txt + +// CHECK: -o {{.*}}/mytmp/hip-temps-linux-gfx1030-{{.*}}.o + +int main() {} Index: clang/test/Driver/hip-temps-windows.hip =================================================================== --- /dev/null +++ clang/test/Driver/hip-temps-windows.hip @@ -0,0 +1,17 @@ +// REQUIRES: x86-registered-target +// REQUIRES: amdgpu-registered-target +// REQUIRES: system-windows + +// Check no temporary files or directores are left after compilation. +// RUN: rm -rf %t/mytmp +// RUN: mkdir -p %t/mytmp +// RUN: env TMP=%t/mytmp %clang --target=x86_64-pc-windows-msvc -nogpulib -nogpuinc \ +// RUN: --rocm-path=%S/Inputs/rocm -no-hip-rt --offload-arch=gfx1030 -v %s 2>&1 | \ +// RUN: FileCheck -check-prefixes=CHECK %s +// RUN: ls %t/mytmp >%t/mytmp.txt 2>&1 +// RUN: touch %t/empty.txt +// RUN: diff %t/mytmp.txt %t/empty.txt + +// CHECK: -o "{{.*}}mytmp\\hip-temps-windows-gfx1030-{{.*}}.o" + +int main() {}