[cfe-dev] C comment to IR comments

Nick Lewycky nlewycky at google.com
Fri Feb 1 17:41:26 PST 2013


On 31 January 2013 14:30, Giacomo Tagliabue <giacomo.tag at gmail.com> wrote:

> Hello, to understand the whole process of transformation from C to IR that
> clang does, we are trying to preserve the comments from the C form
> /*comment*/ to the output IR written with as ";comment"
> Which part of the CLANG source code should be modified in order to do
> that? Is there a library that allows that? Thank you very much!
>

LLVM does not support comments in its in-memory representation or its
bitcode file format, and the .ll parser does nothing with comments but
discard them. There is a way to get .ll files to be emitted with custom
comments using the llvm::AssemblyAnnotationWriter class, but I think you'll
find that your goal of preserving comments in a language which does not
have a concept of comments is a non-starter without significant engineering
effort to add comments as a part of llvm ir.

Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130201/a94dfc50/attachment.html>


More information about the cfe-dev mailing list