Configure readability-identifier-naming for const references

Hi, I want to configure readability-identifier-naming in a way that all function arguments that are constant (or pointing to something constant) are written with prefix “k” and CamelCase, like suggested by the Google style guide. However, I wonder how to configure this for const references and const pointers. Which options from clang-tidy - readability-identifier-naming — Extra Clang Tools 18.0.0git documentation shall I use? My current config can be found below. I am using clang-tidy-12.

Example (with all naming as suggested by clang-tidy-12 with the below configuration):
void MyFunction(
int k_my_var1, // spelling suggested as wanted by clang-tidy, not constant
int const kMyVar2, // spelling suggested as wanted by clang-tidy, constant
int const *my_ptr_1, // spelling suggested as wanted by clang-tidy, pointer is not constant
int *const kMyPtr2, // spelling suggested NOT as wanted by clang-tidy, pointer is constant but pointing to something not constant
int const *const kMyPtr3, // spelling suggested as wanted by clang-tidy, pointer is constant and pointing to something constant
int &my_ref_1, // spelling suggested as wanted by clang-tidy, not constant
int const &my_ref_2 // spelling suggested NOT as wanted by clang-tidy, constant reference
) { … }

CheckOptions:

  • { key: readability-identifier-naming.NamespaceCase, value: lower_case }
  • { key: readability-identifier-naming.ClassCase, value: CamelCase }
  • { key: readability-identifier-naming.StructCase, value: CamelCase }
  • { key: readability-identifier-naming.TemplateParameterCase, value: CamelCase }
  • { key: readability-identifier-naming.FunctionCase, value: CamelCase }
  • { key: readability-identifier-naming.VariableCase, value: lower_case }
  • { key: readability-identifier-naming.MemberCase, value: lower_case }
  • { key: readability-identifier-naming.MemberSuffix, value: _ }
  • { key: readability-identifier-naming.ClassMemberCase, value: lower_case }
  • { key: readability-identifier-naming.ClassMemberSuffix, value: _ }
  • { key: readability-identifier-naming.PrivateMemberCase, value: lower_case }
  • { key: readability-identifier-naming.PrivateMemberSuffix, value: _ }
  • { key: readability-identifier-naming.ProtectedMemberCase, value: lower_case }
  • { key: readability-identifier-naming.ProtectedMemberSuffix, value: _ }
  • { key: readability-identifier-naming.PublicMemberCase, value: lower_case }
  • { key: readability-identifier-naming.PublicMemberSuffix, value: _ }
  • { key: readability-identifier-naming.MacroDefinitionCase, value: UPPER_CASE }
  • { key: readability-identifier-naming.EnumConstantCase, value: CamelCase }
  • { key: readability-identifier-naming.EnumConstantPrefix, value: k }
  • { key: readability-identifier-naming.LocalConstantPointerCase, value: CamelCase }
  • { key: readability-identifier-naming.LocalConstantPointerPrefix, value: k }
  • { key: readability-identifier-naming.LocalConstantCase, value: CamelCase }
  • { key: readability-identifier-naming.LocalConstantPrefix, value: k }
  • { key: readability-identifier-naming.ConstantParameterCase, value: CamelCase }
  • { key: readability-identifier-naming.ConstantParameterPrefix, value: k }
  • { key: readability-identifier-naming.ConstantPointerParameterCase, value: CamelCase }
  • { key: readability-identifier-naming.ConstantPointerParameterPrefix, value: k }
  • { key: readability-identifier-naming.ConstexprVariableCase, value: CamelCase }
  • { key: readability-identifier-naming.ConstexprVariablePrefix, value: k }
  • { key: readability-identifier-naming.GlobalConstantCase, value: CamelCase }
  • { key: readability-identifier-naming.GlobalConstantPrefix, value: k }
  • { key: readability-identifier-naming.StaticConstantCase, value: CamelCase }
  • { key: readability-identifier-naming.StaticConstantPrefix, value: k }
  • { key: readability-identifier-naming.EnumCase, value: CamelCase }
  • { key: readability-identifier-naming.StaticVariableCase, value: lower_case }
  • { key: readability-identifier-naming.MacroDefinitionIgnoredRegexp, value: ‘[1]+([A-Z]+)*$’ }
  • { key: readability-identifier-naming.ParameterCase, value: lower_case }
  • { key: readability-identifier-naming.TypeAliasCase, value: CamelCase }
  • { key: readability-identifier-naming.TypedefCase, value: CamelCase }
  • { key: readability-identifier-naming.IgnoreMainLikeFunctions, value: 1 }

  1. A-Z ↩︎