[PATCH] D24933: Enable configuration files in clang

Michał Górny via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 20 05:19:43 PST 2016


mgorny added a comment.

In https://reviews.llvm.org/D24933#600884, @sepavloff wrote:

> > Whoever makes the `blah-clang` symlink should get to control what the default configuration for `blah-clang` is, I think.
>
> The patch is changed so that config file for `blah-clang` is searched for *only* in the directory where `blah-clang` resides. It prevents a user from overwriting 'system' config files. The idea is that the files in the binary directory are prepared by SDK suppliers who adapt clang for specific needs.


I think this killed my use case. Could this be extended to somehow allow providing configuration for the compiler installed in standard *nix layout? I.e. make it possible to make it search ../../etc/clang or something like that?

>> you can replace a blah-clang symlink with a shell script containing `exec clang @blah.cfg "@$"`
> 
> Due to intermediate shell the environment variables which were not exported would be lost. This solution is OK for build system but from viewpoint of compiler, which must work in any build system, it is too fragile.

I think you are wrong here, or I'm missing something. When clang is spawned, only exported variables are passed to it. An intermediate shell layer won't change this.

However, I don't think forcing an additional wrapper for all clang invocations is a neat idea.


https://reviews.llvm.org/D24933





More information about the cfe-commits mailing list