[cfe-dev] Are there plans for a libDriver?

Nico Weber nicolasweber at gmx.de
Tue Aug 5 10:41:13 PDT 2008


On 05.08.2008, at 18:49, Ted Kremenek wrote:

>
> On Aug 4, 2008, at 1:55 PM, Nico Weber wrote:
>
>> On 04.08.2008, at 22:13, Ted Kremenek wrote:
>>
>>>
>>> On Aug 4, 2008, at 1:07 PM, Nico Weber wrote:
>>>
>>>> Are there plans for a libDriver, which makes writing simple, "one- 
>>>> off"
>>>> clang clients easier? With this library, the amount of code of this
>>>> program could be reduced by a whole order of magnitude (only the
>>>> ASTConsumer, two short loops for the -D and -I options, and the  
>>>> call
>>>> to ParseAST would be left).
>>>
>>> Hi Nico,
>>>
>>> You are not alone.  There is a lot of interest in doing this, but  
>>> nobody has gotten around to doing it yet.  If you are interested,  
>>> feel free to drive some work on this by submitting patches, etc.
>>
>> The attached patch adds directories and Makefiles for a libDriver  
>> and moves the TextDiagnostic classes over there for starters. I  
>> hope `svn diff` encodes `svn mv` information correctly.
>
> As far as this patch is concerned, I think it is a good start.  One  
> problem I see is that TextDiagnostPrinter.cpp currently depends on  
> CommandLine.h, and has static variables to register command line  
> options:
>
>  static llvm::cl::opt<bool>
>  NoShowColumn("fno-show-column",
>               llvm::cl::desc("Do not include column number on  
> diagnostics"));
>  static llvm::cl::opt<bool>
>  NoCaretDiagnostics("fno-caret-diagnostics",
>                     llvm::cl::desc("Do not include source line and  
> caret with"
>                                    " diagnostics"));
>
> This is no good.  We don't want library code automatically  
> registering command line options in this manner.  I'm not certain  
> what the proper mechanism should be for registering options from  
> code in libDriver, but this isn't it, and should definitely be  
> discussed in more detail on cfe-dev.  Ultimately we want libDriver  
> to be usable not only by command line drivers, but potentially from  
> other drivers such as an IDE, a daemon process, a CGI program, etc.

In this case, I moved the options to clang.cpp and added flags to  
TextDiagnosticPrinter, so there are no options in libDriver now.

Nico

-------------- next part --------------
A non-text attachment was scrubbed...
Name: libdriver.patch
Type: application/octet-stream
Size: 27142 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20080805/a6c1fc23/attachment.obj>
-------------- next part --------------



More information about the cfe-dev mailing list