Open Baltoli opened 8 months ago
All for it! I think it's best to just pick a style, make the PR, and then let people nit at it. But I think general consensus is that a consistent style is more important than any particular choice.
Indeed - it's blocked on #995 but once that's resolved I can use the tooling to just apply this style globally and see if there are nitpicks
Introduction
After https://github.com/runtimeverification/llvm-backend/pull/992 [^1], I think it's worth putting the effort in to properly clean up our C++ code with a house style. We use a bunch of different styles in the C++ code, and there is no strong consensus for what the correct solution will look like. This issue is an attempt at an opinionated set of defaults that we can bikeshed, then start to apply gradually to the code.[^2]
Proposed Style
Some things we should also consider that are not directly naming style:
extern "C"
functions with a prefix likekllvm_
(see #992)kore::composite_pattern
rather thankllvm::KORECompositePattern
).Migration Strategy
Once we agree on a style, it should be easily achievable to migrate one stylistic element at a time using
clang-tidy
.[^1]: We'd have avoided this pain by enforcing a consistent naming prefix for our C code so as to remain hygienic when interfacing with the outside world. Nobody other than us is naming their functions
kllvm_arena_alloc
! [^2]: We can hopefully clean up or improve some of the bigger, gnarlier functions that are currently exempted fromclang-tidy
'scongitive-complexity
warnings when we do this.