[llvm-bugs] [Bug 52505] New: Add libclang API to set temporary directory location (especially for preamble-*.pch files)

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Nov 15 01:13:57 PST 2021


            Bug ID: 52505
           Summary: Add libclang API to set temporary directory location
                    (especially for preamble-*.pch files)
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: libclang
          Assignee: unassignedclangbugs at nondot.org
          Reporter: igorkuo at gmail.com
                CC: klimek at google.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

preamble-*.pch files generated by libclang can occupy a lot of disk space. So
it is important for an IDE, which uses libclang, to prevent accumulation of
these files after a crash. This can be done by setting libclang's temporary
directory to a per-session value and removing this directory with all leftover
files after a possible previous crash when the session starts.

It is possible to configure clang's temporary directory location via
platform-dependent environment variables (e.g. TMPDIR, TMP). Setting the
environment variables works well if libclang lives in a separate process (e.g.
in Qt Creator). But when libclang runs in the same process as the rest of the
IDE (like in KDevelop), setting the environment variables is problematic,
because they are inherited by the IDE's code and all child processes it spawns
(compiler, build system and user-provided executables). The IDE must then
remove the temporary directory environment variable from each child process
where it can cause undesirable behavior. A libclang API function to configure
the temporary directory location would greatly simplify cleanup implementation
in this case. Here is the discussion of a rejected implementation of this
feature in KDevelop:

Related bug reports: Bug 52489, Bug 30673.

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20211115/4d9cd7d0/attachment-0001.html>

More information about the llvm-bugs mailing list