[cfe-dev] Advice for front-end design?

Sean Silva via cfe-dev cfe-dev at lists.llvm.org
Fri Sep 18 22:21:56 PDT 2015


On Thu, Sep 17, 2015 at 10:36 PM, Joachim Durchholz via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> Hi all,
>
> I'm starting work on a new language (not going to make excuses for that),
> and my initial plan was to use LLVM as backend.
>
> Looking at the Kaleidoscope tutorial, I found that LLVM-as-backend makes
> no attempt at supporting the frontend side (d'oh); in particular, it
> doesn't offern patterns or best practices for organizing things like input
> stream handling, line/column number bookkeeping, or error message
> generation.
>

See http://llvm.org/docs/doxygen/html/classllvm_1_1SourceMgr.html
We use it in the IR reader, TableGen, FileCheck, LLD's linker scripts, the
YAML parser, and MC's asm parser, among other places (I'm sure I've missed
something that uses it).
Together with MemoryBuffer::getFileOrSTDIN like Russell points out, that
should cover the things you mentioned.

Clang's SourceManager is like SourceMgr but with all sorts of complexity
for Clang's use case; you probably won't want to reuse it.

-- Sean Silva


>
> Would it make sense to turn to clang for that?
> If yes, where should I start reading?
>
> Regards,
> Jo
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150918/af15b165/attachment.html>


More information about the cfe-dev mailing list