On 1 March 2017 at 02:50, Serge Pavlov via Phabricator < revi...@reviews.llvm.org> wrote:
> sepavloff added a comment. > > Glad to know that someone is interested in this feature! > Below is actual proposal. > > **Adding named configuration files to clang driver** > > A configuration file is a collection of driver options, which are inserted > into command line before other options specified in the clang invocation. > It groups related options together and allows specifying them in simpler, > more flexible and less error prone way than just listing the options > somewhere in build scripts. Configuration file may be thought as a "macro" > that names an option set and is expanded when the driver is called. This > feature must be helpful when a user need to specify many options, cross > compilation is likely to be such case. > > Configuration file can be specified by either of two methods: > > - by command line option `--config <config_file>`, or > - by using special executable file names, such as `armv7l-clang`. > > If the option `--config` is used, its argument is treated as a path to > configuration file if it contains a directory separator, otherwise the file > is searched for in the set of directories described below. If option > `--config` is absent and clang executable has name in the form > `armv7l-clang`, driver will search for file `armv7l.cfg` in the same set of > directories. Similar encoding is already used by clang to specify target. > > The set of directories where configuration files are searched for consists > of at most three directories, checked in this order: > > - user directory (like `~/.llvm`), > - system directory (like `/etc/llvm`), > - the directory where clang executable resides. > > User and system directories are optional, they are reserved for > distribution or SDK suppliers. By default they are absent, corresponding > directories can be specified by cmake arguments > `CLANG_CONFIG_FILE_SYSTEM_DIR` and `CLANG_CONFIG_FILE_USER_DIR`. The first > found file is used. > > Format of configuration file is similar to file used in the construct > `@file`, it is a set of options. Configuration file have advantage over > this construct: > > - it is searched for in well-known places rather than in current directory, > This (and suppressing unused-argument warnings) might well be sufficient to justify a different command-line syntax rather than @file... > - it may contain comments, long options may be split between lines using > trailing backslashes, > - other files may be included by `@file` and they will be resolved > relative to the including file, > ... but I think we should just add these extensions to our @file handling, and then use the exact same syntax and code to handle config files and @file files. That is, the difference between @ and --config would be that the latter looks in a different directory and suppresses "unused argument" warnings, but they would otherwise be identical. - the file may be encoded in executable name, > - unused options from configuration file do not produce warnings. > > > https://reviews.llvm.org/D24933 > > > >
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits