<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/100468>100468</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
`clang++` leaves empty directories in `/tmp` with `-x cuda` and `-x hip`
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ShreyasKhandekar
</td>
</tr>
</table>
<pre>
**Summary of the problem**
Compiling any program with the `-x cuda` or `-x hip` flags leaves empty directories per compile in `/tmp` that are not cleaned up.
**Details and steps to reproduce**
This happens with both nvidia and amd, for any file (CUDA/HIP/C++ )
Ex: A simple file with nothing CUDA or HIP specific:
```c++
// sample.cc
#include <iostream>
int main() {
std::cout << "Hello, World!" << std::endl;
return 0;
}
```
For CUDA compile with:
```console
clang++ -x cuda sample.cc
```
Or for HIP we compile with
```console
clang++ -x hip sample.cc
```
We can see the temp files being created anew (looking for the newest files):
```console
$ find /tmp -maxdepth 1 -type d -name "*sample*" -printf '%T+ %p\n' | sort -r | head -n 20
2024-07-22+13:25:32.9609698390 /tmp/sample-646dae
2024-07-22+13:25:32.9609698390 /tmp/sample-56e594
2024-07-22+13:25:11.3652665900 /tmp/sample-ad5032
2024-07-22+13:25:11.3652665900 /tmp/sample-1e8723
2024-07-22+13:24:44.7776319390 /tmp/sample-f98e7b
2024-07-22+13:24:44.7776319390 /tmp/sample-f459d6
```
I was able to reproduce this with LLVM 14 and 15.
I am on CUDA version 11.8 and ROCM 4
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVd1u2zgTfRr6ZmCBGv1ZF7pwnBoJvhYtvna315Q4trilSIGkkvjtF5Tsxkl_0EUAAbYonjNzDmc4wnt1NEQNK25YcbsSU-itaz73jk7C_68XRtI34VatlaeG8VvGtwzj83kaBuFOYA8QeoLR2VbTsHxb9u3sMCqtzBGEOcUNRycGeFShnxGs5Osn6CYpWMnB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