[flang-dev] Flang Coding Style

Johannes Doerfert via flang-dev flang-dev at lists.llvm.org
Thu Apr 1 13:51:38 PDT 2021


I was struggling with myself because I don't want to derail the current 
progress,
however, I figured it is still worth pointing this out (again), the 
earlier the better.

---

I read over Flang patches regularly and I got more and more annoyed by 
the coding style. I don't
know who designed it and why but it causes actual burden for people that 
otherwise work with the LLVM style.

I am aware this was discussed before but I vaguely remember we wanted to 
get closer to LLVM style
and I am worried that goal has been forgotten by now.

My initial suggestion is to change the online style guide, highlighted 
with *ABC*.

  * Use /clang-format/ from llvm *trunk* on all C++ source and header
    files before every merge to master. All code layout should be
    determined by means of clang-format.
  * *Where LLVM’s C++ style guide
    <https://llvm.org/docs/CodingStandards.html#style-issues> is clear
    on usage, follow it.*
  * *Otherwise,* where a clear precedent exists in the project, follow it.

Filenames should follow the LLVM naming style.

The "Overall design preferences" should be rewritten. The content is not 
only add odds with existing
practices in LLVM (& MLIR, OpenACC, OpenMP, ...) but probably also one 
of the reasons we have to discuss
Flang compile times regularly. I mean, I love really crafty C++ 
meta-programming solutions as much as the next
person but we should rethink the trade-off we are advocating for.

Once we redefine the rules we can adopt the LLVM style piece by piece or 
in one big swoop. Either way, let's
actually follow through on those discussions we had Feb 2020.

~ Johannes


-- 
───────────────────
∽ Johannes (he/his)



More information about the flang-dev mailing list