RSSThe plan fell off.

Mitchell's Homepage the trolling business

LLVM Coding Standard, in a nutshell

Note: 这份文件主要是为大模型 Review 我的提交时准备的,Agents 可以读取文件且非常聪明,所以不会深入细节

以及我觉得这个改一改就可以当 Agents 做其他项目时的规范,所以就放上来了。

References:

本文档是活的文档,会随着我自己的工作进展而更新内容,且不保证已有内容的正确性。

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