<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/65029>65029</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [clangd] Support for configuring the path to store PCH files.
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          memchr
      </td>
    </tr>
</table>

<pre>
    ### Feature Request

Configure the path for storing PCH files through command line flags or a configuration file.

### Motivation
At present, clangd stores `preamble-*.pch` files in `/tmp`, which is commonly mounted on many Linux distributions as [tmpfs](https://en.wikipedia.org/wiki/Tmpfs), a file system that stores data in volatile memory.

As has been reported several times, clangd sometimes fills the /tmp directory with relatively large preamble pch files and leaves them behind.

Since tmpfs uses volatile memory, OOM kills can potentially occur.

### Workarounds

As a workaround, it has been suggested to set a preferred path for **TMPDIR** when starting LSP clients or clangd. Nevertheless, this could lead to unintended results as **TMPDIR** is a canonical POSIX environmental variable that affects more than just clangd. 

Additionally, it could be inconvenient or impractical to set TMPDIR exclusively for clangd or LSP clients like vscode. With a command line flag, one can use `clangd.arguments` to determine the storage location for PCH files.

Thank you for your time and effort.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0lE1vGzkMhn-NfCFqjOXYtQ8-uAmMLdBsgiZA90prODNq9DErUk797xfSOF8tFgjisSUOXz58SWS2fSDaqdUXtbqZYZYhpp0nb4Y0O8b2vFN6Of3BgVByIvhO_2ZiUc2NavbT_-sYOtuXQxkIRpQBupiAJSYberi__gs664hBhhRzP4CJ3mNowdlA0DnsGWICBHN5EYqNocbM3-d5E3MbxZ7qrelkLzAmYgqi9DUYh6Fva35iUOtmTIT-6OiT0vv5aAa1bi6KbCjnSh_Ej_XhGp4HawawXFXG4M7gYw5CLcQAHsMZvtmQf0FrWZI95qKCARnU6ov4sWO1ulF6M4iMrJZ7pQ9KHyjM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