[clang-tools-extra] [clang-tidy] identifier-naming: TrimPrefixSuffix option to avoid concatenating multiple pre(suf)fixes (PR #181502)
Baranov Victor via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 10 01:03:20 PDT 2026
================
@@ -1084,11 +1088,34 @@ bool IdentifierNamingCheck::isParamInMainLikeFunction(
return Matcher.match(FDecl->getName());
}
+static void trimPrefixesAndSuffixes(
+ StringRef &Mid,
+ ArrayRef<std::optional<IdentifierNamingCheck::NamingStyle>> NamingStyles,
+ bool TrimPrefixes, bool TrimSuffixes) {
+ bool LoopWhileToRemove = true;
+ while (LoopWhileToRemove) {
+ LoopWhileToRemove = false;
+ for (unsigned I = 0; I < SK_Count; ++I) {
+ if (const std::optional<IdentifierNamingCheck::NamingStyle> &OtherStyle =
+ NamingStyles[I]) {
+ while (TrimPrefixes && !OtherStyle->Prefix.empty() &&
----------------
vbvictor wrote:
Can be a range-based for loop:
```cpp
for (const auto &OtherStyle : NamingStyles) {
if (OtherStyle) {
```
https://github.com/llvm/llvm-project/pull/181502
More information about the cfe-commits
mailing list