[PATCH] D24933: Enable configuration files in clang
Serge Pavlov via cfe-commits
cfe-commits at lists.llvm.org
Tue May 9 21:25:45 PDT 2017
2017-05-10 3:46 GMT+07:00 Richard Smith <richard at metafoo.co.uk>:
> On 1 March 2017 at 02:50, Serge Pavlov via Phabricator <
> reviews at reviews.llvm.org> wrote:
>> 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
> This (and suppressing unused-argument warnings) might well be sufficient
> to justify a different command-line syntax rather than @file...
Construct `@file` in this implementation is used only to read parts of
config file inside containing file. Driver knows that it processes config
file and can adjust treatment of `@file`. On the other hand, driver might
parse config files in a more complicated way, for instance, it could treat
line `# include(file_name)` as a command to include another 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.
Changing treatment of `@file` can cause compatibility issues, in
particular, both libiberty and cl resolves file name relative to current
directory. So driver must deduce that `@file` is used to load config file
rather than merely to organize arguments. Another difference is that
`@file` inserts its content in the place where it occurs, while `--config`
always puts arguments before user specified options. The following
clang --config a.cfg -opt1 -opt2 file1.cpp
clang -opt1 -opt2 file1.cpp --config a.cfg
are equivalent, but variants with `@file` can have different effect.
> - the file may be encoded in executable name,
>> - unused options from configuration file do not produce warnings.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-commits