@@ -16,14 +16,16 @@ When reviewing code, focus on:
1616- Header files must have proper header guards.
1717- Non-trivial classes and public methods should have Doxygen documentation.
1818- Use ` // ` or ` /// ` comments normally; avoid block comments unless necessary.
19+ - Non-trivial code should have comments explaining what it does and why. Avoid comments that explain how it does it at a micro level.
1920
2021## Language & Compiler Issues
2122
2223- Write portable code; wrap non-portable code in interfaces.
2324- Do not use RTTI or exceptions.
2425- Prefer C++-style casts over C-style casts.
25- - Avoid static constructors or global objects with heavy initialization .
26+ - Do not use static constructors .
2627- Use ` class ` or ` struct ` consistently; ` struct ` only for all-public data.
28+ - When then same class is declared or defined multiple times, make sure it's consistently done using either ` class ` or ` struct ` .
2729
2830## Headers & Library Layering
2931
@@ -37,7 +39,7 @@ When reviewing code, focus on:
3739## Control Flow & Structure
3840
3941- Prefer early exits over deep nesting.
40- - Avoid ` else ` after ` return ` , ` continue ` , ` break ` , or ` goto ` .
42+ - Do not use ` else ` after ` return ` , ` continue ` , ` break ` , or ` goto ` .
4143- Encapsulate loops that compute predicates into helper functions.
4244
4345## Naming
@@ -50,27 +52,28 @@ When reviewing code, focus on:
5052## General Guidelines
5153
5254- Use ` assert ` liberally; prefer ` llvm_unreachable ` for unreachable states.
53- - Avoid ` using namespace std; ` in headers.
54- - Ensure at least one out-of-line virtual method per class with virtuals .
55- - For ` switch ` on enums, omit ` default ` to catch missing cases .
56- - Prefer range-based ` for ` loops.
55+ - Do not use ` using namespace std; ` in headers.
56+ - Provide a virtual method anchor for classes defined in headers .
57+ - Do not use default labels in fully covered switches over enumerations .
58+ - Use range-based for loops wherever possible .
5759- Capture ` end() ` outside loops if not using range-based iteration.
58- - Use LLVM’s ` raw_ostream ` instead of ` <iostream> ` .
59- - Avoid ` std::endl ` ; use ` \n ` unless flushing is needed.
60- - Methods in class definitions are already inline—don’t add ` inline ` .
60+ - Including ` <iostream> ` is forbidded. Use LLVM’s ` raw_ostream ` instead.
61+ - Don’t use ` inline ` when defining a function in a class definition.
6162
6263## Microscopic Details
6364
6465- Preserve existing style in modified code.
6566- Prefer pre-increment (` ++i ` ) when value is unused.
67+ - Use ` private ` , ` protected ` , or ` public ` keyword as appropriate to restrict class member visibility.
6668- Omit braces for single-statement ` if ` , ` else ` , ` while ` , ` for ` unless needed.
6769
6870## Review Style
6971
7072- Be specific and actionable in feedback.
7173- Explain the "why" behind recommendations.
72- - Link back to the LLVM Coding Standars : https://llvm.org/docs/CodingStandards.html .
74+ - Link back to the LLVM Coding Standards : https://llvm.org/docs/CodingStandards.html .
7375- Ask clarifying questions when code intent is unclear.
7476
75- Remember that these standards are ** guidelines** . Always prioritize consistency
76- with the style that is already being used by the surrounding code.
77+ Ignore formatting and assume that's handled by external tools like ` clang-format ` and ` black ` .
78+ Remember that these standards are ** guidelines** .
79+ Always prioritize consistency with the style that is already being used by the surrounding code.
0 commit comments