libclang: Pass Clang install directory to driver via argv[0].
authorPeter Collingbourne <peter@pcc.me.uk>
Tue, 21 Mar 2023 01:38:04 +0000 (18:38 -0700)
committerPeter Collingbourne <peter@pcc.me.uk>
Wed, 22 Mar 2023 22:28:21 +0000 (15:28 -0700)
commit201fdef40dd6ec193d18d39638454a3c972f1fec
tree4c1c912ab6df666ef3c8290b67f38503adf29aa5
parentfe27495be2040007c7b20844a9371b06156ab405
libclang: Pass Clang install directory to driver via argv[0].

Various driver features, such as the sysroot path detection for Android
targets, rely on being able to find the Clang install directory (look
for callers of `getDriver().getInstalledDir()`). However, the install
directory isn't currently being plumbed through to the driver, which is
conventionally done via the argv[0] passed to the Driver constructor.

It looks like D14695 attempted to fix this by adding another API that
allows specifying the argv[0]. However, rather than requiring every
user of libclang to switch to this API for correct behavior, let's have
the other existing APIs work by default, by using the existing logic in
libclang for finding the install directory.

Differential Revision: https://reviews.llvm.org/D146497
clang/docs/ReleaseNotes.rst
clang/include/clang-c/Index.h
clang/test/Index/record-completion-invocation.c
clang/test/Index/record-parsing-invocation.c
clang/tools/libclang/CIndex.cpp