Skip to content

Commit 3fd77ac

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 71478ec commit 3fd77ac

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

llvm/docs/CodingStandards.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1499,6 +1499,12 @@ Do:
14991499
}
15001500
};
15011501

1502+
Make non-member variables and functions in `.cpp` files static
1503+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1504+
1505+
When non-member functions or variables are defined in a `.cpp`` file and need
1506+
not be referenced outside that file, make them `static`.
1507+
15021508
Microscopic Details
15031509
-------------------
15041510

0 commit comments

Comments
 (0)