[cfe-dev] Configuration files

Richard Pennington via cfe-dev cfe-dev at lists.llvm.org
Mon Sep 19 04:43:46 PDT 2016

On 09/19/2016 03:06 AM, Serge Pavlov via cfe-dev wrote:
> Hi all,
> I would like to propose implementing configuration files in clang. The 
> idea is to read some set of options prior to the options specified in 
> a command line in every tool invocation. These options are taken from 
> a file which is searched either in predefined place or its location is 
> specified by environmental variable.
I've been using something similar for quite a while in ELLCC 
(http://ellcc.org), my clang based cross compilation environment. The 
way I've implemented it is that if the clang executable is named 
{xxx}-ecc, the file xxx.cfg is read. Otherwise the argument to the 
-target option is checked to see if it is the name of a config file. In 
either case, I put the options in the config file on the command line as 
if they entered at the point on the command line where the name or 
-target option is, so that following options override those in the 
config file.

I also use the config files to tell the driver how to find libraries, etc.
I used YAML as the format, just because LLVM had a YAML parser. Here's 
an example of what one of the config files look like: 

It has proven to be very handy to support a wide variety of targets.


More information about the cfe-dev mailing list