[PATCH] Add diagnostic capabilities in LLVM (frontend part)

Quentin Colombet qcolombet at apple.com
Tue Dec 17 15:03:36 PST 2013


Hi Dimitri,

Thanks for the quick reply!

New patch attached.

On Dec 17, 2013, at 11:58 AM, Dmitri Gribenko <gribozavr at gmail.com> wrote:

> On Tue, Dec 17, 2013 at 11:22 AM, Quentin Colombet <qcolombet at apple.com> wrote:
>> - Tests.
>> I made some tests locally, but the patch does not add any test case. The
>> question is how can we add tests that require both a backend and a frontend
>> in either the frontend or the backend?
> 
> A lot of tests in Clang have "REQUIRES: x86-registered-target" --
> please take a look at them.
Thanks, using your advice, I have added a test in test/Frontend/backend-diagnostic.c.

> 
> About the patch:
> 
> 80 columns.
Oh sorry about that, I was sure I had run clang-format… apparently not!
Fixed.

> 
> +/// DiagnosticHandler2 - This function is invoked when the backend needs
> +/// to report something to the user.
> 
> Please don't duplicate function name in comments.
Fixed.

> 
> +/// The \p DI interface provides two basic information:
> +/// getKind() helps to determines what it is reporting and
> +/// getSeverity() decribes how bad this is.
> 
> This does not really belong to the documentation for
> DiagnosticHandler2(), I think.
Removed.

> 
> +#define SeveritySwitch(Severity, GroupName, DiagID)
>         \
> +  switch (Severity) {
>         \
> 
> Please wrap this in do {...} while(false), so that the trailing
> semicolon in the macro invocation gets correctly attached to the
> expansion.
Done.

> 
> Also, this macro could have a better name -- maybe ComputeSeverity?
Renamed into ComputeDiagID.

Thanks,
-Quentin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: BackendDiagnostic.patch
Type: application/octet-stream
Size: 9916 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131217/3238c818/attachment.obj>
-------------- next part --------------


> 
> Dmitri
> 
> -- 
> main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
> (j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/



More information about the cfe-commits mailing list