RSSThe plan fell off.

Mitchell's Homepage living in a simulation.

LLVM Coding Standard, in a nutshell

Note: This document was mainly put together to help LLMs review my commits. Agents can read files and are quite smart, so I’m not going into a lot of detail here.

Also, I figured this could be tweaked into a general standard for agents working on other projects too, so I’m putting it up here.

References:

This is a living document, it’ll get updated as my own work progresses, and there’s no guarantee the existing content is correct.

The Golden Rule

If you are extending, enhancing, or bug fixing already implemented code, use the style that is already being used so that the source is uniform and easy to follow.

You should refer to typical files in the repo when reviewing user’s code. (e.g. grep -rn *.cpp)

Formatting

Run these commands after making changes/ before starting code review:

Fix/Report issues if linter failed.

Comments

Whitespace

No trailing whitespaces

Casts

class and struct

auto

#include as Little as Possible

continue and Early Exits

No Predicate Loops, use Predicate Functions

Miscs

Naming

Always check inconsistent naming when reviewing/writing code:

Exception: classes that mimic STL classes can have member names in STL’s style of lowercase words separated by underscores.

Assert

Also, see llvm_unreachable

Forbidden usage

Omit braces when possible

Check UNIX newline at EOF

Preferred APIs

Please remember the #include rule