diff --git a/clang-tools-extra/clang-tidy/bugprone/ReservedIdentifierCheck.h b/clang-tools-extra/clang-tidy/bugprone/ReservedIdentifierCheck.h --- a/clang-tools-extra/clang-tidy/bugprone/ReservedIdentifierCheck.h +++ b/clang-tools-extra/clang-tidy/bugprone/ReservedIdentifierCheck.h @@ -41,7 +41,7 @@ private: llvm::Optional - GetDeclFailureInfo(const NamedDecl *Decl, + GetDeclFailureInfo(const StringRef &TypeName, const NamedDecl *Decl, const SourceManager &SM) const override; llvm::Optional GetMacroFailureInfo(const Token &MacroNameTok, diff --git a/clang-tools-extra/clang-tidy/bugprone/ReservedIdentifierCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/ReservedIdentifierCheck.cpp --- a/clang-tools-extra/clang-tidy/bugprone/ReservedIdentifierCheck.cpp +++ b/clang-tools-extra/clang-tidy/bugprone/ReservedIdentifierCheck.cpp @@ -152,7 +152,8 @@ } Optional -ReservedIdentifierCheck::GetDeclFailureInfo(const NamedDecl *Decl, +ReservedIdentifierCheck::GetDeclFailureInfo(const StringRef &Type, + const NamedDecl *Decl, const SourceManager &) const { assert(Decl && Decl->getIdentifier() && !Decl->getName().empty() && !Decl->isImplicit() && diff --git a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.h b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.h --- a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.h +++ b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.h @@ -36,6 +36,9 @@ IdentifierNamingCheck(StringRef Name, ClangTidyContext *Context); ~IdentifierNamingCheck(); + static const std::string + getHungarianNotionTypePrefix(const std::string &TypeName, + const NamedDecl *Decl); void storeOptions(ClangTidyOptions::OptionMap &Opts) override; enum CaseType { @@ -45,7 +48,8 @@ CT_UpperCase, CT_CamelCase, CT_CamelSnakeCase, - CT_CamelSnakeBack + CT_CamelSnakeBack, + CT_HungarianNotion }; struct NamingStyle { @@ -62,7 +66,7 @@ private: llvm::Optional - GetDeclFailureInfo(const NamedDecl *Decl, + GetDeclFailureInfo(const StringRef &Type, const NamedDecl *Decl, const SourceManager &SM) const override; llvm::Optional GetMacroFailureInfo(const Token &MacroNameTok, diff --git a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp --- a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp +++ b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp @@ -44,7 +44,9 @@ {readability::IdentifierNamingCheck::CT_CamelSnakeCase, "Camel_Snake_Case"}, {readability::IdentifierNamingCheck::CT_CamelSnakeBack, - "camel_Snake_Back"}}; + "camel_Snake_Back"}, + {readability::IdentifierNamingCheck::CT_HungarianNotion, + "szHungarianNotion"}}; return llvm::makeArrayRef(Mapping); } @@ -178,8 +180,118 @@ Options.store(Opts, "IgnoreMainLikeFunctions", IgnoreMainLikeFunctions); } -static bool matchesStyle(StringRef Name, - IdentifierNamingCheck::NamingStyle Style) { +static const std::string +getHungarianNotionTypePrefix(const std::string &TypeName, + const NamedDecl *Decl) { + if (0 == TypeName.length()) { + return TypeName; + } + + // clang-format off + const static llvm::StringMap HungarainNotionTable = { + {"int8_t", "i8"}, + {"int16_t", "i16"}, + {"int32_t", "i32"}, + {"int64_t", "i64"}, + {"uint8_t", "u8"}, + {"uint16_t", "u16"}, + {"uint32_t", "u32"}, + {"uint64_t", "u64"}, + {"float", "f"}, + {"double", "d"}, + {"char", "c"}, + {"bool", "b"}, + {"_Bool", "b"}, + {"int", "i"}, + {"size_t", "n"}, + {"wchar_t", "wc"}, + {"short", "s"}, + {"signed", "i"}, + {"unsigned", "u"}, + {"long", "l"}}; + // clang-format on + + std::string ClonedTypeName = TypeName; + + // Handle null string + std::string PrefixStr; + if (const auto *TD = dyn_cast(Decl)) { + auto QT = TD->getType(); + if (QT->isPointerType()) { + // clang-format off + const static llvm::StringMap NullString = { + {"char*", "sz"}, + {"wchar_t*", "wsz"}}; + // clang-format on + for (auto &Type : NullString) { + const auto &Key = Type.getKey(); + if (ClonedTypeName.find(Key.str()) == 0) { + PrefixStr = Type.getValue().str(); + ClonedTypeName = ClonedTypeName.substr( + Key.size(), ClonedTypeName.size() - Key.size()); + break; + } + } + } else if (QT->isArrayType()) { + // clang-format off + const static llvm::StringMap NullString = { + {"char", "sz"}, + {"wchar_t", "wsz"}}; + // clang-format on + for (auto &Type : NullString) { + const auto &Key = Type.getKey(); + if (ClonedTypeName.find(Key.str()) == 0) { + PrefixStr = Type.getValue().str(); + ClonedTypeName = ClonedTypeName.substr( + Key.size(), ClonedTypeName.size() - Key.size()); + break; + } + } + } + } + + // Handle pointers + size_t nPtrCount = [&](std::string TypeName) -> size_t { + size_t nPos = TypeName.find('*'); + size_t nCnt = 0; + for (; nPos < TypeName.length(); nPos++, nCnt++) { + if ('*' != TypeName[nPos]) + break; + } + return nCnt; + }(ClonedTypeName); + if (nPtrCount > 0) { + ClonedTypeName = [&](std::string str, const std::string &from, + const std::string &to) { + size_t start_pos = 0; + while ((start_pos = str.find(from, start_pos)) != std::string::npos) { + str.replace(start_pos, from.length(), to); + start_pos += to.length(); + } + return str; + }(ClonedTypeName, "*", ""); + } + + for (auto &Type : HungarainNotionTable) { + const auto &Key = Type.getKey(); + if (ClonedTypeName == Key) { + PrefixStr = Type.getValue().str(); + break; + } + } + + if (nPtrCount > 0) { + for (size_t nIdx = 0; nIdx < nPtrCount; nIdx++) { + PrefixStr.insert(PrefixStr.begin(), 'p'); + } + } + + return PrefixStr; +} + +static bool matchesStyle(StringRef Type, StringRef Name, + IdentifierNamingCheck::NamingStyle Style, + const NamedDecl *Decl) { static llvm::Regex Matchers[] = { llvm::Regex("^.*$"), llvm::Regex("^[a-z][a-z0-9_]*$"), @@ -188,6 +300,7 @@ llvm::Regex("^[A-Z][a-zA-Z0-9]*$"), llvm::Regex("^[A-Z]([a-z0-9]*(_[A-Z])?)*"), llvm::Regex("^[a-z]([a-z0-9]*(_[A-Z])?)*"), + llvm::Regex("^[A-Z][a-zA-Z0-9]*$"), }; if (!Name.consume_front(Style.Prefix)) @@ -200,13 +313,26 @@ if (Name.startswith("_") || Name.endswith("_")) return false; - if (Style.Case && !Matchers[static_cast(*Style.Case)].match(Name)) + if (Style.Case == IdentifierNamingCheck::CaseType::CT_HungarianNotion) { + const auto TypePrefix = getHungarianNotionTypePrefix(Type.str(), Decl); + if (TypePrefix.length() > 0) { + if (!Name.startswith(TypePrefix)) + return false; + Name = Name.drop_front(TypePrefix.size()); + } + } + + size_t MatcherIndex = static_cast(*Style.Case); + auto MatcherResult = Matchers[MatcherIndex].match(Name); + + if (Style.Case && !MatcherResult) return false; return true; } -static std::string fixupWithCase(StringRef Name, +static std::string fixupWithCase(const StringRef &Type, const StringRef &Name, + const Decl *pDecl, IdentifierNamingCheck::CaseType Case) { static llvm::Regex Splitter( "([a-z0-9A-Z]*)(_+)|([A-Z]?[a-z0-9]+)([A-Z]|$)|([A-Z]+)([A-Z]|$)"); @@ -298,8 +424,26 @@ Fixup += Word.substr(1).lower(); } break; - } + case IdentifierNamingCheck::CT_HungarianNotion: { + const NamedDecl *pNamedDecl = dyn_cast(pDecl); + const auto TypePrefix = + getHungarianNotionTypePrefix(Type.str(), pNamedDecl); + Fixup = TypePrefix; + for (size_t nIdx = 0; nIdx < Words.size(); nIdx++) { + // Skip first part if it's a lowercase string + if (nIdx == 0) { + const bool bLowerAlnum = + std::all_of(Words[nIdx].begin(), Words[nIdx].end(), + [](const char c) { return isdigit(c) || islower(c); }); + if (bLowerAlnum) + continue; + } + Fixup += Words[nIdx]; + } + break; + } + } return Fixup.str().str(); } @@ -365,10 +509,12 @@ } static std::string -fixupWithStyle(StringRef Name, - const IdentifierNamingCheck::NamingStyle &Style) { +fixupWithStyle(const StringRef &Type, const StringRef &Name, + const IdentifierNamingCheck::NamingStyle &Style, + const Decl *pDecl) { const std::string Fixed = fixupWithCase( - Name, Style.Case.getValueOr(IdentifierNamingCheck::CaseType::CT_AnyCase)); + Type, Name, pDecl, + Style.Case.getValueOr(IdentifierNamingCheck::CaseType::CT_AnyCase)); StringRef Mid = StringRef(Fixed).trim("_"); if (Mid.empty()) Mid = "_"; @@ -384,7 +530,7 @@ if (isa(D) && NamingStyles[SK_ObjcIvar]) return SK_ObjcIvar; - + if (isa(D) && NamingStyles[SK_Typedef]) return SK_Typedef; @@ -482,7 +628,8 @@ return SK_ConstexprVariable; if (!Type.isNull() && Type.isConstQualified()) { - if (Type.getTypePtr()->isAnyPointerType() && NamingStyles[SK_ConstantPointerParameter]) + if (Type.getTypePtr()->isAnyPointerType() && + NamingStyles[SK_ConstantPointerParameter]) return SK_ConstantPointerParameter; if (NamingStyles[SK_ConstantParameter]) @@ -495,8 +642,9 @@ if (Decl->isParameterPack() && NamingStyles[SK_ParameterPack]) return SK_ParameterPack; - if (!Type.isNull() && Type.getTypePtr()->isAnyPointerType() && NamingStyles[SK_PointerParameter]) - return SK_PointerParameter; + if (!Type.isNull() && Type.getTypePtr()->isAnyPointerType() && + NamingStyles[SK_PointerParameter]) + return SK_PointerParameter; if (NamingStyles[SK_Parameter]) return SK_Parameter; @@ -514,7 +662,8 @@ if (Decl->isStaticDataMember() && NamingStyles[SK_ClassConstant]) return SK_ClassConstant; - if (Decl->isFileVarDecl() && Type.getTypePtr()->isAnyPointerType() && NamingStyles[SK_GlobalConstantPointer]) + if (Decl->isFileVarDecl() && Type.getTypePtr()->isAnyPointerType() && + NamingStyles[SK_GlobalConstantPointer]) return SK_GlobalConstantPointer; if (Decl->isFileVarDecl() && NamingStyles[SK_GlobalConstant]) @@ -523,7 +672,8 @@ if (Decl->isStaticLocal() && NamingStyles[SK_StaticConstant]) return SK_StaticConstant; - if (Decl->isLocalVarDecl() && Type.getTypePtr()->isAnyPointerType() && NamingStyles[SK_LocalConstantPointer]) + if (Decl->isLocalVarDecl() && Type.getTypePtr()->isAnyPointerType() && + NamingStyles[SK_LocalConstantPointer]) return SK_LocalConstantPointer; if (Decl->isLocalVarDecl() && NamingStyles[SK_LocalConstant]) @@ -539,7 +689,8 @@ if (Decl->isStaticDataMember() && NamingStyles[SK_ClassMember]) return SK_ClassMember; - if (Decl->isFileVarDecl() && Type.getTypePtr()->isAnyPointerType() && NamingStyles[SK_GlobalPointer]) + if (Decl->isFileVarDecl() && Type.getTypePtr()->isAnyPointerType() && + NamingStyles[SK_GlobalPointer]) return SK_GlobalPointer; if (Decl->isFileVarDecl() && NamingStyles[SK_GlobalVariable]) @@ -547,8 +698,9 @@ if (Decl->isStaticLocal() && NamingStyles[SK_StaticVariable]) return SK_StaticVariable; - - if (Decl->isLocalVarDecl() && Type.getTypePtr()->isAnyPointerType() && NamingStyles[SK_LocalPointer]) + + if (Decl->isLocalVarDecl() && Type.getTypePtr()->isAnyPointerType() && + NamingStyles[SK_LocalPointer]) return SK_LocalPointer; if (Decl->isLocalVarDecl() && NamingStyles[SK_LocalVariable]) @@ -655,21 +807,22 @@ } static llvm::Optional getFailureInfo( - StringRef Name, SourceLocation Location, + const StringRef &Type, const StringRef &Name, const NamedDecl *Decl, + SourceLocation Location, ArrayRef> NamingStyles, StyleKind SK, const SourceManager &SM, bool IgnoreFailedSplit) { if (SK == SK_Invalid || !NamingStyles[SK]) return None; const IdentifierNamingCheck::NamingStyle &Style = *NamingStyles[SK]; - if (matchesStyle(Name, Style)) + if (matchesStyle(Type, Name, Style, Decl)) return None; - std::string KindName = - fixupWithCase(StyleNames[SK], IdentifierNamingCheck::CT_LowerCase); + std::string KindName = fixupWithCase(Type, StyleNames[SK], Decl, + IdentifierNamingCheck::CT_LowerCase); std::replace(KindName.begin(), KindName.end(), '_', ' '); - std::string Fixup = fixupWithStyle(Name, Style); + std::string Fixup = fixupWithStyle(Type, Name, Style, Decl); if (StringRef(Fixup).equals(Name)) { if (!IgnoreFailedSplit) { LLVM_DEBUG(Location.print(llvm::dbgs(), SM); @@ -684,14 +837,15 @@ } llvm::Optional -IdentifierNamingCheck::GetDeclFailureInfo(const NamedDecl *Decl, +IdentifierNamingCheck::GetDeclFailureInfo(const StringRef &Type, + const NamedDecl *Decl, const SourceManager &SM) const { SourceLocation Loc = Decl->getLocation(); ArrayRef> NamingStyles = getStyleForFile(SM.getFilename(Loc)); return getFailureInfo( - Decl->getName(), Loc, NamingStyles, + Type, Decl->getName(), Decl, Loc, NamingStyles, findStyleKind(Decl, NamingStyles, IgnoreMainLikeFunctions), SM, IgnoreFailedSplit); } @@ -701,8 +855,8 @@ const SourceManager &SM) const { SourceLocation Loc = MacroNameTok.getLocation(); - return getFailureInfo(MacroNameTok.getIdentifierInfo()->getName(), Loc, - getStyleForFile(SM.getFilename(Loc)), + return getFailureInfo("", MacroNameTok.getIdentifierInfo()->getName(), NULL, + Loc, getStyleForFile(SM.getFilename(Loc)), SK_MacroDefinition, SM, IgnoreFailedSplit); } diff --git a/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.h b/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.h --- a/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.h +++ b/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.h @@ -124,7 +124,8 @@ /// Overridden by derived classes, returns information about if and how a Decl /// failed the check. A 'None' result means the Decl did not fail the check. virtual llvm::Optional - GetDeclFailureInfo(const NamedDecl *Decl, const SourceManager &SM) const = 0; + GetDeclFailureInfo(const StringRef &Type, const NamedDecl *Decl, + const SourceManager &SM) const = 0; /// Overridden by derived classes, returns information about if and how a /// macro failed the check. A 'None' result means the macro did not fail the diff --git a/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp b/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp --- a/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp +++ b/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp @@ -398,6 +398,50 @@ } } + // Get type text of variable declarations. + std::string TypeName; + if (const auto *Value = Result.Nodes.getNodeAs("decl")) { + const auto &SrcMgr = Decl->getASTContext().getSourceManager(); + const char *szBegin = SrcMgr.getCharacterData(Decl->getBeginLoc()); + const char *szCurr = SrcMgr.getCharacterData(Decl->getLocation()); + const intptr_t iPtrLen = szCurr - szBegin; + if (iPtrLen > 0) { + std::string Type(szBegin, iPtrLen); + + const static std::list Keywords = { + // Qualifier + "const", "volatile", + // Storage class specifiers + "auto", "register", "static", "extern", "thread_local", + // Constexpr specifiers + "constexpr", "constinit", "const_cast", "consteval"}; + + // Remove keywords + for (const auto &kw : Keywords) { + for (size_t pos = 0; + (pos = Type.find(kw, pos)) != std::string::npos;) { + Type.replace(pos, kw.length(), ""); + } + } + + // Replace spaces with single space + for (size_t pos = 0; (pos = Type.find(" ", pos)) != std::string::npos; + pos += strlen(" ")) { + Type.replace(pos, strlen(" "), " "); + } + + // Replace " *" with "*" + for (size_t pos = 0; (pos = Type.find(" *", pos)) != std::string::npos; + pos += strlen("*")) { + Type.replace(pos, strlen(" *"), "*"); + } + + Type = Type.erase(Type.find_last_not_of(" ") + 1); + Type = Type.erase(0, Type.find_first_not_of(" ")); + TypeName = Type; + } + } + // Fix type aliases in function declarations. if (const auto *Value = Result.Nodes.getNodeAs("decl")) { if (const auto *Typedef = @@ -418,7 +462,7 @@ return; Optional MaybeFailure = - GetDeclFailureInfo(Decl, *Result.SourceManager); + GetDeclFailureInfo(TypeName, Decl, *Result.SourceManager); if (!MaybeFailure) return; FailureInfo &Info = *MaybeFailure; diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-hungarain-notion.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-hungarain-notion.cpp new file mode 100644 --- /dev/null +++ b/clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-hungarain-notion.cpp @@ -0,0 +1,107 @@ +#include +#include + +// RUN: %check_clang_tidy %s readability-identifier-naming %t -- \ +// RUN: -config="{CheckOptions: [\ +// RUN: {key: readability-identifier-naming.VariableCase, value: szHungarianNotion}, \ +// RUN: ]}" + +const char* NamePtr1 = "Name"; +// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: invalid case style for variable 'NamePtr1' [readability-identifier-naming] +// CHECK-FIXES: {{^}}const char* szNamePtr1 = "Name"; + +const char *NamePtr2 = "Name"; +// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: invalid case style for variable 'NamePtr2' [readability-identifier-naming] +// CHECK-FIXES: {{^}}const char *szNamePtr2 = "Name"; + +const char NameArray[] = "Name"; +// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: invalid case style for variable 'NameArray' [readability-identifier-naming] +// CHECK-FIXES: {{^}}const char szNameArray[] = "Name"; + +void *BufferPtr1 = NULL; +// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for variable 'BufferPtr1' [readability-identifier-naming] +// CHECK-FIXES: {{^}}void *pBufferPtr1 = NULL; + +void **BufferPtr2 = NULL; +// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for variable 'BufferPtr2' [readability-identifier-naming] +// CHECK-FIXES: {{^}}void **ppBufferPtr2 = NULL; + +void **pBufferPtr3 = NULL; +// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for variable 'pBufferPtr3' [readability-identifier-naming] +// CHECK-FIXES: {{^}}void **ppBufferPtr3 = NULL; + +int8_t ValueI8 = 0; +// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for variable 'ValueI8' [readability-identifier-naming] +// CHECK-FIXES: {{^}}int8_t i8ValueI8 = 0; + +int16_t ValueI16 = 0; +// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for variable 'ValueI16' [readability-identifier-naming] +// CHECK-FIXES: {{^}}int16_t i16ValueI16 = 0; + +int32_t ValueI32 = 0; +// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for variable 'ValueI32' [readability-identifier-naming] +// CHECK-FIXES: {{^}}int32_t i32ValueI32 = 0; + +int64_t ValueI64 = 0; +// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for variable 'ValueI64' [readability-identifier-naming] +// CHECK-FIXES: {{^}}int64_t i64ValueI64 = 0; + +uint8_t ValueU8 = 0; +// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for variable 'ValueU8' [readability-identifier-naming] +// CHECK-FIXES: {{^}}uint8_t u8ValueU8 = 0; + +uint16_t ValueU16 = 0; +// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: invalid case style for variable 'ValueU16' [readability-identifier-naming] +// CHECK-FIXES: {{^}}uint16_t u16ValueU16 = 0; + +uint32_t ValueU32 = 0; +// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: invalid case style for variable 'ValueU32' [readability-identifier-naming] +// CHECK-FIXES: {{^}}uint32_t u32ValueU32 = 0; + +uint64_t ValueU64 = 0; +// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: invalid case style for variable 'ValueU64' [readability-identifier-naming] +// CHECK-FIXES: {{^}}uint64_t u64ValueU64 = 0; + +float ValueFloat = 0; +// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for variable 'ValueFloat' [readability-identifier-naming] +// CHECK-FIXES: {{^}}float fValueFloat = 0; + +double ValueDouble = 0; +// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for variable 'ValueDouble' [readability-identifier-naming] +// CHECK-FIXES: {{^}}double dValueDouble = 0; + +char ValueChar = 'c'; +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for variable 'ValueChar' [readability-identifier-naming] +// CHECK-FIXES: {{^}}char cValueChar = 'c'; + +bool ValueBool = true; +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for variable 'ValueBool' [readability-identifier-naming] +// CHECK-FIXES: {{^}}bool bValueBool = true; + +int ValueInt = 0; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for variable 'ValueInt' [readability-identifier-naming] +// CHECK-FIXES: {{^}}int iValueInt = 0; + +size_t ValueSize = 0; +// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for variable 'ValueSize' [readability-identifier-naming] +// CHECK-FIXES: {{^}}size_t nValueSize = 0; + +wchar_t ValueWchar = 'w'; +// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for variable 'ValueWchar' [readability-identifier-naming] +// CHECK-FIXES: {{^}}wchar_t wcValueWchar = 'w'; + +short ValueShort = 0; +// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for variable 'ValueShort' [readability-identifier-naming] +// CHECK-FIXES: {{^}}short sValueShort = 0; + +unsigned ValueUnsigned = 0; +// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: invalid case style for variable 'ValueUnsigned' [readability-identifier-naming] +// CHECK-FIXES: {{^}}unsigned uValueUnsigned = 0; + +signed ValueSigned = 0; +// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for variable 'ValueSigned' [readability-identifier-naming] +// CHECK-FIXES: {{^}}signed iValueSigned = 0; + +long ValueLong = 0; +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for variable 'ValueLong' [readability-identifier-naming] +// CHECK-FIXES: {{^}}long lValueLong = 0; \ No newline at end of file