Skip to content

Commit 57e03cd

Browse files
committed
[CodingStandard] Add a rule about non-member definitions in CPP files
- Add a rule suggesting that non-member definitions in CPP files should be made static unless they are referenced outside that file.
1 parent 1f51038 commit 57e03cd

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

llvm/docs/CodingStandards.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1640,6 +1640,10 @@ you have no immediate way to tell if this function is local to the file. In
16401640
contrast, when the function is marked static, you don't need to cross-reference
16411641
faraway places in the file to tell that the function is local.
16421642

1643+
Related to this issue, when non-member functions or variables are defined in a
1644+
`.cpp`` file and need not be referenced outside that file, make them `static`.
1645+
1646+
16431647
Don't Use Braces on Simple Single-Statement Bodies of if/else/loop Statements
16441648
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
16451649

0 commit comments

Comments
 (0)