Hi everyone,
As you probably know, there are 2 coding styles currently being used in LLVM Flang:
- Flang’s C++ style, used in e.g. pre-scan, parsing, sema and the driver,
- MLIR style used in e.g. lowering and code-gen.
In the driver, we have been using Flang’s C++ style as that was the predominant style used in LLVM Flang when we began implementing it (~2 years ago). This is no longer the case and I would like to re-factor the driver to use the MLIR style instead.
Why?
The driver has to interface with many parts of the LLVM project (i.e. all components of Flang and various bits from Clang, MLIR and LLVM). It would make a lot of sense for it to switch to the style that’s most widely used.
Also, from my personal experience, most contributors are very familiar with LLVM’s or MLIR’s coding style. However, they get confused when creating/reviewing patches for the driver. Indeed, Flang’s C++ style is quite different compared to LLVM/MLIR style. I feel that this change would make working with the driver noticeably easier
Why not use the LLVM style instead?
The MLIR style is very similar to LLVM, so it shouldn’t make a huge difference to contributors. However, if we use the LLVM style then we will effectively be introducing 3rd coding style into Flang. I feel that we should avoid that.
What about other parts of Flang?
This proposal covers the driver only. Other parts or still subject to upstreaming and are also more active.
Phabricator patch
https://reviews.llvm.org/D125007
Next steps
I don’t really see any downsides to this. If you do have any reservations, please let me know! Otherwise, I would appreciate if you could review the patch
Thank you,
-Andrzej