[cfe-dev] [F18/AST] Using clang tooling with f18

Petr Penzin via cfe-dev cfe-dev at lists.llvm.org
Tue Oct 23 19:26:19 PDT 2018


On 10/22/2018 08:20, David Greene wrote:
>> There was a different Flang project before Nvidia's involvement, which
>> successfully used and extended Clang ASTs. The code is still on
>> Github, along with updated fork (which builds with trunk). It
>> implements a fair share of the Fortran features that you have
>> mentioned using (what is essentially) Clang's infrastructure.
> Thanks for the pointer!  Hopefully we can learn some things from that
> project.  It looks like it is still active (last commit three days ago),
> but it lacks Fortran 95 support.
You are welcome! Feel free to ask questions or participate. Yes, it is 
behind (as GSoC project that started it was), though it is making progress.
>
>> IMO, it is possible to use Clang ASTs, but also there is a lot of
>> other code and patterns in Clang that would be useful for a Fortran
>> frontend - error handling, driver, testing, etc. It would make sense
>> to take those things from Clang rather than reinvent them in F18.
> I completely agree.  The goal is to have f18 become an "official" LLVM
> project.  In that sense it will be the second frontend to LLVM (I know
> about llgo but I don't think there was any attempt at reuse).  There's a
> tension between making rapid progress on f18 and reusing clang
> components.  Not having worked entensively in either codebase, I don't
> have a good sense of how to resolve that tension.
Flang (the new one) also suffers from this, but it is understandable, 
since it is based on PGI Fortran compiler, which is much older than 
Clang. To me the fact that f19 also took a completely different route is 
a bit of a puzzle. I am not an LLVM insider, but I still doubt that 
multiple unrelated implementations of the same tooling would be acceptable.

-Petr



More information about the cfe-dev mailing list