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

Nico Weber nicolasweber at gmx.de
Tue Aug 5 11:40:56 PDT 2008


> Instead of setShowColumn, etc., it seems better just to set these  
> values in the ctor of TextDiagnosticPrinter.  That would transform:
>
>      TextDiagnosticPrinter* TextDiagPrinter = new  
> TextDiagnosticPrinter;
>      TextDiagPrinter->setShowColumn(!NoShowColumn);
>      TextDiagPrinter->setShowCaretDiagnostics(!NoCaretDiagnostics);
>
> into:
>
>      TextDiagnosticPrinter* TextDiagPrinter = new  
> TextDiagnosticPrinter(NoShowColumn, NoCaretDiagnostics);
>
> It doesn't seem likely that carets/columns would be switched on/off  
> after the printer is constructed.

I thought about that, but I don't like bools in constructors. It's ok  
if they come from a variable, but when I see code like

   TextDiagnosticPrinter printer(true, false);

then I wonder what those bools do. Most clients will use the default  
parameters anyways.

Furthermore, TDP has an error stream as parameter that defaults to  
cerr. Should that be first or last? Both uses seem equally likely, so  
there should probably at least two constructors.

But if this is the clang way, I won't object. Updated patch (with just  
this change) is attached.

Nico

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



More information about the cfe-dev mailing list