This patch allows users to configure clang with option e.g. -DCLANG_CONFIG_FILE_USER_DIR=~/.config/clang or invoke clang with --config-user-dir=~/.config/clang.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/test/Driver/config-file3.c tests --config-user-dir= but I cannot think of a portable way testing this.
RUN: echo ~; %clang -### --config-user-dir=~ ... doesn't work as the selected directory is not dumped.
I can dump user configuration file directory via clang --config-user-dir=<some directory> -v, but
RUN: { echo tilde: ~; %clang -v --config-user-dir=~ 2>&1; } | FileCheck %s -check-prefix CHECK-TILDE doesn't work on Windows.
I am waiting on @mgorny 's opinion for https://blogs.gentoo.org/mgorny/2022/10/07/clang-in-gentoo-now-sets-default-runtimes-via-config-file/
I think you should be able to test it via overriding HOME envvar. I suppose you can limit the test to Unix.
Thanks. I haven't tested it but if it works for you and the test passes, LGTM.
@MaskRay, would you be able to test and push it? I don't have a recent clang build tree handy.
clang/test/Driver/config-file3.c | ||
---|---|---|
227 | -### is missing. I fixed it in 37216b4b3aaab1fb293b7f628f8dd4999c0abb80 |
-### is missing. I fixed it in 37216b4b3aaab1fb293b7f628f8dd4999c0abb80