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

Dmitri Gribenko gribozavr at gmail.com
Tue Dec 17 11:58:18 PST 2013


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.

About the patch:

80 columns.

+/// DiagnosticHandler2 - This function is invoked when the backend needs
+/// to report something to the user.

Please don't duplicate function name in comments.

+/// 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.

+#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.

Also, this macro could have a better name -- maybe ComputeSeverity?

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