[cfe-dev] Generating C++ with Sourcemaps

Timothy Baldridge via cfe-dev cfe-dev at lists.llvm.org
Thu Apr 6 09:48:12 PDT 2017


Apologies if this is the wrong mailing list.

I'm looking to generate some C++ from another set of input files. Now in a
perfect world I'd love to get line numbers and source references that link
back to my input files, and not to the C++ files. Think of something like
Cython in Python. It translates Python to C, but all the error messages
point back to Python.

I can think of two main ways to do this via libclang, and perhaps both of
them are bad ideas, so I'm open to more options:

A) I could parse my input files and build up libclang ASTs, I could then
compile these ASTs via clang and then run those ASTs through the normal
optimization/code emission passes.

B) I could compile my own version of clang that accepted an external
"sourcemap" file. This file would be used to replace the data held in the
SourceManager code with other filenames/offsets.

C) Some other option I haven't thought of?

So any thoughts as to the best way to go about this?

Thanks,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170406/d76e599d/attachment.html>


More information about the cfe-dev mailing list