Adding new Diagnostics to Clang ?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Adding new Diagnostics to Clang ?

kalyan ponnala

Hi,

Can someone please tell me what the purpose of the following files:

  • "*.inc"
  • "*.def"
  • "*.td"

Additionally, how are these files used within the Clang infrastructure?

I am trying to dig into the Diagnostics inside Clang. I found out that DiagnosticKinds.def file is used to add an entry for some Diagnostics.

I could not find the file's location in the Clang / LLVM distribution. Additionally, the "DiagnosticKinds.def" file that is linked from the Clang "InternalsManual.html" is broken.

Can anyone please tell me where to find this file or is there a new approach to adding an entry for a new Diagnostics?

thanks, 

--
Kalyan Ponnala
phone: 8163772059

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Adding new Diagnostics to Clang ?

Eli Friedman
On Sun, Mar 7, 2010 at 1:36 PM, kalyan ponnala <[hidden email]> wrote:
> Hi,
>
> Can someone please tell me what the purpose of the following files:
>
> "*.inc"
> "*.def"
> "*.td"
>
> Additionally, how are these files used within the Clang infrastructure?

> I am trying to dig into the Diagnostics inside Clang. I found out that
> DiagnosticKinds.def file is used to add an entry for some Diagnostics.

That's outdated; .def files are no longer used for diagnostics.

.inc files are generated; don't modify them directly.

I think you want Diagnostic*Kinds.td; the diagnostics are split
depending on where they are used.

-Eli

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Adding new Diagnostics to Clang ?

Charles Davis-3
In reply to this post by kalyan ponnala
Hello again, Kalyan,

On 3/7/10 2:36 PM, kalyan ponnala wrote:
> Hi,
>
> Can someone please tell me what the purpose of the following files:
>
>     * "*.inc"
These are the files generated from the *.td files. They're regenerated
on every build, and included just like *.h files. Since they're
regenerated, you shouldn't modify them. Your changes will be lost!
>     * "*.def"
These files--at least in the LLVM and Clang projects--have nothing to do
with Windows' DLLs, just so you know.

These are files that use macros in a massive list of something. In
typical usage, a file will define the macros the *.def files use, then
#include the file.

For example, we have include/clang/AST/TypeNodes.def, which is a list of
all the type nodes supported by the AST library. This file is included
by include/clang/AST/Type.h when it's defining the type kind
enumerators. And this is just one of the many uses of that file!
>     * "*.td"
These are TableGen sources. They're processed by the TableGen tool
(tblgen.exe on Windows). Their purpose depends on context. In the
context of diagnostics, they contain the definitions of the various
diagnostics. (Note that TableGen has to be specially taught to
understand a particular class of *.td files.)
> I am trying to dig into the Diagnostics inside Clang. I found out that
> DiagnosticKinds.def file is used to add an entry for some Diagnostics.
Not anymore. That file doesn't exist now. Instead, we have the
Diagnostic*Kinds.td files. Those are the files you want to modify.
>
> I could not find the file's location in the Clang / LLVM
> distribution. Additionally, the "DiagnosticKinds.def" file that is
> linked from the Clang "InternalsManual.html" is broken.
Because that file does not exist anymore. That documentation is
seriously out of date, and someone needs to update it.
>
> Can anyone please tell me where to find this file or is there a new
> approach to adding an entry for a new Diagnostics?
Again, the Diagnostic*Kinds.td files are the ones you want to modify.
The exact one you want to modify depends on which library is going to
use it. For example, if you're adding a diagnostic to be used by the
Sema library, add your new diagnostic to DiagnosticSemaKinds.td.

If you're adding a warning, and your warning belongs to a group that
doesn't exist yet, you'll also have to modify DiagnosticGroups.td to
include your new group.
>
> thanks,
You're welcome.

Chip
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev