[clang-tools-extra] [clang-tidy] Add fine-grained options to `misc-use-internal-linkage` (PR #173310)

via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 22 19:00:56 PST 2025


================
@@ -50,3 +50,16 @@ Options
 
   - `UseStatic`
     Add ``static`` for internal linkage variable and function.
+
+.. option:: AnalyzeFunctions
+
+  Whether to suggest giving functions internal linkage. Default is `true`.
+
+.. option:: AnalyzeVariables
+
+  Whether to suggest giving variables internal linkage. Default is `true`.
+
+.. option:: AnalyzeTypes
+
+  (C++-only) Whether to suggest giving user-defined types (structs,
----------------
zeyi2 wrote:

Nit: I'm not sure if `(C++-only)` is the preferred wording here. I grepped the codebase and found that `(C++ only)` (without the hyphen) is much more common in comments (e.g. `clang/lib/Sema/SemaType.cpp`, `clang/include/clang/AST/Decl.h`).

Maybe we could simply drop the hyphen or switch to natural language similar to [`modernize-unary-static-assert`](https://github.com/llvm/llvm-project/blob/b836942013978b3ab5d253da4569fc3ced7278b4/clang-tools-extra/docs/clang-tidy/checks/modernize/unary-static-assert.rst?plain=1#L10)

https://github.com/llvm/llvm-project/pull/173310


More information about the cfe-commits mailing list