[clang-tools-extra] 2b9b5bc - [clang-tidy] Add new case type to check variables with Hungarian notation
Min-Yih Hsu via cfe-commits
cfe-commits at lists.llvm.org
Sun Aug 1 15:23:26 PDT 2021
Author: Douglas Chen
Date: 2021-08-01T15:22:17-07:00
New Revision: 2b9b5bc0409ff460849baf1fe4d7edda99c8db83
URL: https://github.com/llvm/llvm-project/commit/2b9b5bc0409ff460849baf1fe4d7edda99c8db83
DIFF: https://github.com/llvm/llvm-project/commit/2b9b5bc0409ff460849baf1fe4d7edda99c8db83.diff
LOG: [clang-tidy] Add new case type to check variables with Hungarian notation
Add IdentifierNamingCheck::CaseType, CT_HungarianNotation, supporting
naming check with Hungarian notation.
Differential Revision: https://reviews.llvm.org/D86671
Added:
clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-hungarian-notation-cfgfile.cpp
clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-hungarian-notation.cpp
Modified:
clang-tools-extra/clang-tidy/ClangTidyCheck.cpp
clang-tools-extra/clang-tidy/ClangTidyCheck.h
clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.h
clang-tools-extra/docs/clang-tidy/checks/readability-identifier-naming.rst
Removed:
################################################################################
diff --git a/clang-tools-extra/clang-tidy/ClangTidyCheck.cpp b/clang-tools-extra/clang-tidy/ClangTidyCheck.cpp
index f447ee41f6f8f..10a30c39f232f 100644
--- a/clang-tools-extra/clang-tidy/ClangTidyCheck.cpp
+++ b/clang-tools-extra/clang-tidy/ClangTidyCheck.cpp
@@ -34,7 +34,7 @@ DiagnosticBuilder ClangTidyCheck::diag(StringRef Message,
DiagnosticBuilder
ClangTidyCheck::configurationDiag(StringRef Description,
- DiagnosticIDs::Level Level) {
+ DiagnosticIDs::Level Level) const {
return Context->configurationDiag(Description, Level);
}
diff --git a/clang-tools-extra/clang-tidy/ClangTidyCheck.h b/clang-tools-extra/clang-tidy/ClangTidyCheck.h
index 20e9b8e47e6f4..102e82ce85a88 100644
--- a/clang-tools-extra/clang-tidy/ClangTidyCheck.h
+++ b/clang-tools-extra/clang-tidy/ClangTidyCheck.h
@@ -123,7 +123,7 @@ class ClangTidyCheck : public ast_matchers::MatchFinder::MatchCallback {
/// Adds a diagnostic to report errors in the check's configuration.
DiagnosticBuilder
configurationDiag(StringRef Description,
- DiagnosticIDs::Level Level = DiagnosticIDs::Warning);
+ DiagnosticIDs::Level Level = DiagnosticIDs::Warning) const;
/// Should store all options supported by this check with their
/// current values or default values for options that haven't been overridden.
diff --git a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
index 12853fa148239..dbcb2b0bc37d5 100644
--- a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
@@ -19,6 +19,7 @@
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/Regex.h"
+#include "llvm/Support/YAMLParser.h"
#define DEBUG_TYPE "clang-tidy"
@@ -48,6 +49,22 @@ OptionEnumMapping<
return llvm::makeArrayRef(Mapping);
}
+template <>
+struct OptionEnumMapping<
+ readability::IdentifierNamingCheck::HungarianPrefixType> {
+ using HungarianPrefixType =
+ readability::IdentifierNamingCheck::HungarianPrefixType;
+ static llvm::ArrayRef<std::pair<HungarianPrefixType, StringRef>>
+ getEnumMapping() {
+ static constexpr std::pair<HungarianPrefixType, StringRef> Mapping[] = {
+ {HungarianPrefixType::HPT_Off, "Off"},
+ {HungarianPrefixType::HPT_On, "On"},
+ {HungarianPrefixType::HPT_LowerCase, "LowerCase"},
+ {HungarianPrefixType::HPT_CamelCase, "CamelCase"}};
+ return llvm::makeArrayRef(Mapping);
+ }
+};
+
namespace readability {
// clang-format off
@@ -105,7 +122,7 @@ namespace readability {
m(MacroDefinition) \
m(ObjcIvar) \
-enum StyleKind {
+enum StyleKind : int {
#define ENUMERATE(v) SK_ ## v,
NAMING_KEYS(ENUMERATE)
#undef ENUMERATE
@@ -119,15 +136,103 @@ static StringRef const StyleNames[] = {
#undef STRINGIZE
};
+#define HUNGARIAN_NOTATION_PRIMITIVE_TYPES(m) \
+ m(int8_t) \
+ m(int16_t) \
+ m(int32_t) \
+ m(int64_t) \
+ m(uint8_t) \
+ m(uint16_t) \
+ m(uint32_t) \
+ m(uint64_t) \
+ m(char8_t) \
+ m(char16_t) \
+ m(char32_t) \
+ m(float) \
+ m(double) \
+ m(char) \
+ m(bool) \
+ m(_Bool) \
+ m(int) \
+ m(size_t) \
+ m(wchar_t) \
+ m(short-int) \
+ m(short) \
+ m(signed-int) \
+ m(signed-short) \
+ m(signed-short-int) \
+ m(signed-long-long-int) \
+ m(signed-long-long) \
+ m(signed-long-int) \
+ m(signed-long) \
+ m(signed) \
+ m(unsigned-long-long-int) \
+ m(unsigned-long-long) \
+ m(unsigned-long-int) \
+ m(unsigned-long) \
+ m(unsigned-short-int) \
+ m(unsigned-short) \
+ m(unsigned-int) \
+ m(unsigned) \
+ m(long-long-int) \
+ m(long-double) \
+ m(long-long) \
+ m(long-int) \
+ m(long) \
+ m(ptr
diff _t) \
+
+static StringRef const HungarainNotationPrimitiveTypes[] = {
+#define STRINGIZE(v) #v,
+ HUNGARIAN_NOTATION_PRIMITIVE_TYPES(STRINGIZE)
+#undef STRINGIZE
+};
+
+#define HUNGARIAN_NOTATION_USER_DEFINED_TYPES(m) \
+ m(BOOL) \
+ m(BOOLEAN) \
+ m(BYTE) \
+ m(CHAR) \
+ m(UCHAR) \
+ m(SHORT) \
+ m(USHORT) \
+ m(WORD) \
+ m(DWORD) \
+ m(DWORD32) \
+ m(DWORD64) \
+ m(LONG) \
+ m(ULONG) \
+ m(ULONG32) \
+ m(ULONG64) \
+ m(ULONGLONG) \
+ m(HANDLE) \
+ m(INT) \
+ m(INT8) \
+ m(INT16) \
+ m(INT32) \
+ m(INT64) \
+ m(UINT) \
+ m(UINT8) \
+ m(UINT16) \
+ m(UINT32) \
+ m(UINT64) \
+ m(PVOID) \
+
+static StringRef const HungarainNotationUserDefinedTypes[] = {
+#define STRINGIZE(v) #v,
+ HUNGARIAN_NOTATION_USER_DEFINED_TYPES(STRINGIZE)
+#undef STRINGIZE
+};
+
+
#undef NAMING_KEYS
// clang-format on
IdentifierNamingCheck::NamingStyle::NamingStyle(
llvm::Optional<IdentifierNamingCheck::CaseType> Case,
const std::string &Prefix, const std::string &Suffix,
- const std::string &IgnoredRegexpStr)
+ const std::string &IgnoredRegexpStr, HungarianPrefixType HPType)
: Case(Case), Prefix(Prefix), Suffix(Suffix),
- IgnoredRegexpStr(IgnoredRegexpStr) {
+ IgnoredRegexpStr(IgnoredRegexpStr), HPType(HPType) {
if (!IgnoredRegexpStr.empty()) {
IgnoredRegexp =
llvm::Regex(llvm::SmallString<128>({"^", IgnoredRegexpStr, "$"}));
@@ -137,14 +242,28 @@ IdentifierNamingCheck::NamingStyle::NamingStyle(
}
}
-static IdentifierNamingCheck::FileStyle
-getFileStyleFromOptions(const ClangTidyCheck::OptionsView &Options) {
+IdentifierNamingCheck::FileStyle IdentifierNamingCheck::getFileStyleFromOptions(
+ const ClangTidyCheck::OptionsView &Options) const {
+ IdentifierNamingCheck::HungarianNotationOption HNOption;
+
+ HungarianNotation.loadDefaultConfig(HNOption);
+ HungarianNotation.loadFileConfig(Options, HNOption);
+
SmallVector<llvm::Optional<IdentifierNamingCheck::NamingStyle>, 0> Styles;
Styles.resize(SK_Count);
SmallString<64> StyleString;
for (unsigned I = 0; I < SK_Count; ++I) {
StyleString = StyleNames[I];
size_t StyleSize = StyleString.size();
+
+ StyleString.append("HungarianPrefix");
+ auto HPTOpt =
+ Options.get<IdentifierNamingCheck::HungarianPrefixType>(StyleString);
+ if (!HungarianNotation.checkOptionValid(I, StyleString) &&
+ HPTOpt.hasValue())
+ configurationDiag("invalid identifier naming option '%0'") << StyleString;
+ StyleString.resize(StyleSize);
+
StyleString.append("IgnoredRegexp");
std::string IgnoredRegexpStr = Options.get(StyleString, "");
StyleString.resize(StyleSize);
@@ -160,12 +279,115 @@ getFileStyleFromOptions(const ClangTidyCheck::OptionsView &Options) {
Options.get<IdentifierNamingCheck::CaseType>(StyleString);
if (CaseOptional || !Prefix.empty() || !Postfix.empty() ||
- !IgnoredRegexpStr.empty())
+ !IgnoredRegexpStr.empty() || HPTOpt)
Styles[I].emplace(std::move(CaseOptional), std::move(Prefix),
- std::move(Postfix), std::move(IgnoredRegexpStr));
+ std::move(Postfix), std::move(IgnoredRegexpStr),
+ HPTOpt.getValueOr(IdentifierNamingCheck::HPT_Off));
}
bool IgnoreMainLike = Options.get("IgnoreMainLikeFunctions", false);
- return {std::move(Styles), IgnoreMainLike};
+ return {std::move(Styles), std::move(HNOption), IgnoreMainLike};
+}
+
+std::string IdentifierNamingCheck::HungarianNotation::getDeclTypeName(
+ const NamedDecl *ND) const {
+ const auto *VD = dyn_cast<ValueDecl>(ND);
+ if (!VD)
+ return {};
+
+ if (isa<FunctionDecl, EnumConstantDecl>(ND))
+ return {};
+
+ // Get type text of variable declarations.
+ auto &SM = VD->getASTContext().getSourceManager();
+ const char *Begin = SM.getCharacterData(VD->getBeginLoc());
+ const char *End = SM.getCharacterData(VD->getEndLoc());
+ intptr_t StrLen = End - Begin;
+
+ // FIXME: Sometimes the value that returns from ValDecl->getEndLoc()
+ // is wrong(out of location of Decl). This causes `StrLen` will be assigned
+ // an unexpected large value. Current workaround to find the terminated
+ // character instead of the `getEndLoc()` function.
+ const char *EOL = strchr(Begin, '\n');
+ if (!EOL)
+ EOL = Begin + strlen(Begin);
+
+ const std::vector<const char *> PosList = {
+ strchr(Begin, '='), strchr(Begin, ';'), strchr(Begin, ','),
+ strchr(Begin, ')'), EOL};
+ for (const auto &Pos : PosList) {
+ if (Pos > Begin)
+ EOL = std::min(EOL, Pos);
+ }
+
+ StrLen = EOL - Begin;
+ std::string TypeName;
+ if (StrLen > 0) {
+ std::string Type(Begin, StrLen);
+
+ static constexpr StringRef Keywords[] = {
+ // Constexpr specifiers
+ "constexpr", "constinit", "consteval",
+ // Qualifier
+ "const", "volatile", "restrict", "mutable",
+ // Storage class specifiers
+ "register", "static", "extern", "thread_local",
+ // Other keywords
+ "virtual"};
+
+ // Remove keywords
+ for (StringRef Kw : Keywords) {
+ for (size_t Pos = 0;
+ (Pos = Type.find(Kw.data(), Pos)) != std::string::npos;) {
+ Type.replace(Pos, Kw.size(), "");
+ }
+ }
+ TypeName = Type.erase(0, Type.find_first_not_of(" "));
+
+ // 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(" &"), "&");
+ }
+
+ // Replace " *" with "* ".
+ for (size_t Pos = 0; (Pos = Type.find(" *", Pos)) != std::string::npos;
+ Pos += strlen("*")) {
+ Type.replace(Pos, strlen(" *"), "* ");
+ }
+
+ // Remove redundant tailing.
+ static constexpr StringRef TailsOfMultiWordType[] = {
+ " int", " char", " double", " long", " short"};
+ bool RedundantRemoved = false;
+ for (auto Kw : TailsOfMultiWordType) {
+ size_t Pos = Type.rfind(Kw.data());
+ if (Pos != std::string::npos) {
+ Type = Type.substr(0, Pos + Kw.size());
+ RedundantRemoved = true;
+ break;
+ }
+ }
+ TypeName = Type.erase(0, Type.find_first_not_of(" "));
+ if (!RedundantRemoved) {
+ std::size_t FoundSpace = Type.find(" ");
+ if (FoundSpace != std::string::npos)
+ Type = Type.substr(0, FoundSpace);
+ }
+
+ TypeName = Type.erase(0, Type.find_first_not_of(" "));
+
+ QualType QT = VD->getType();
+ if (!QT.isNull() && QT->isArrayType())
+ TypeName.append("[]");
+ }
+
+ return TypeName;
}
IdentifierNamingCheck::IdentifierNamingCheck(StringRef Name,
@@ -185,6 +407,386 @@ IdentifierNamingCheck::IdentifierNamingCheck(StringRef Name,
IdentifierNamingCheck::~IdentifierNamingCheck() = default;
+bool IdentifierNamingCheck::HungarianNotation::checkOptionValid(
+ int StyleKindIndex, StringRef StyleString) const {
+ if ((StyleKindIndex >= SK_EnumConstant) &&
+ (StyleKindIndex <= SK_ConstantParameter))
+ return true;
+
+ if ((StyleKindIndex >= SK_Parameter) && (StyleKindIndex <= SK_Enum))
+ return true;
+
+ return false;
+}
+
+bool IdentifierNamingCheck::HungarianNotation::isOptionEnabled(
+ StringRef OptionKey, const llvm::StringMap<std::string> &StrMap) const {
+ if (OptionKey.empty())
+ return false;
+
+ auto Iter = StrMap.find(OptionKey);
+ if (Iter == StrMap.end())
+ return false;
+
+ llvm::Optional<bool> Parsed = llvm::yaml::parseBool(Iter->getValue());
+ return *Parsed;
+}
+
+void IdentifierNamingCheck::HungarianNotation::loadFileConfig(
+ const ClangTidyCheck::OptionsView &Options,
+ IdentifierNamingCheck::HungarianNotationOption &HNOption) const {
+
+ static constexpr StringRef HNOpts[] = {"TreatStructAsClass"};
+ static constexpr StringRef HNDerivedTypes[] = {"Array", "Pointer",
+ "FunctionPointer"};
+
+ StringRef Section = "HungarianNotation.";
+
+ SmallString<128> Buffer;
+ for (const auto &Opt : HNOpts) {
+ Buffer.assign({Section, "General.", Opt});
+ std::string Val = Options.get(Buffer, "");
+ if (!Val.empty())
+ HNOption.General[Opt] = std::move(Val);
+ }
+
+ for (const auto &Type : HNDerivedTypes) {
+ Buffer.assign({Section, "DerivedType.", Type});
+ std::string Val = Options.get(Buffer, "");
+ if (!Val.empty())
+ HNOption.DerivedType[Type] = std::move(Val);
+ }
+
+ static constexpr std::pair<StringRef, StringRef> HNCStrings[] = {
+ {"CharPrinter", "char*"},
+ {"CharArray", "char[]"},
+ {"WideCharPrinter", "wchar_t*"},
+ {"WideCharArray", "wchar_t[]"}};
+
+ for (const auto &CStr : HNCStrings) {
+ Buffer.assign({Section, "CString.", CStr.first});
+ std::string Val = Options.get(Buffer, "");
+ if (!Val.empty())
+ HNOption.CString[CStr.first] = std::move(Val);
+ }
+
+ for (const auto &PrimType : HungarainNotationPrimitiveTypes) {
+ Buffer.assign({Section, "PrimitiveType.", PrimType});
+ std::string Val = Options.get(Buffer, "");
+ if (!Val.empty()) {
+ std::string Type = PrimType.str();
+ std::replace(Type.begin(), Type.end(), '-', ' ');
+ HNOption.PrimitiveType[Type] = std::move(Val);
+ }
+ }
+
+ for (const auto &Type : HungarainNotationUserDefinedTypes) {
+ Buffer.assign({Section, "UserDefinedType.", Type});
+ std::string Val = Options.get(Buffer, "");
+ if (!Val.empty())
+ HNOption.UserDefinedType[Type] = std::move(Val);
+ }
+}
+
+std::string IdentifierNamingCheck::HungarianNotation::getPrefix(
+ const Decl *D,
+ const IdentifierNamingCheck::HungarianNotationOption &HNOption) const {
+ const auto *ND = dyn_cast<NamedDecl>(D);
+ if (!ND)
+ return {};
+
+ std::string Prefix;
+ if (const auto *ECD = dyn_cast<EnumConstantDecl>(ND)) {
+ Prefix = getEnumPrefix(ECD);
+ } else if (const auto *CRD = dyn_cast<CXXRecordDecl>(ND)) {
+ Prefix = getClassPrefix(CRD, HNOption);
+ } else if (isa<VarDecl, FieldDecl, RecordDecl>(ND)) {
+ std::string TypeName = getDeclTypeName(ND);
+ if (!TypeName.empty())
+ Prefix = getDataTypePrefix(TypeName, ND, HNOption);
+ }
+
+ return Prefix;
+}
+
+bool IdentifierNamingCheck::HungarianNotation::removeDuplicatedPrefix(
+ SmallVector<StringRef, 8> &Words,
+ const IdentifierNamingCheck::HungarianNotationOption &HNOption) const {
+ if (Words.size() <= 1)
+ return true;
+
+ std::string CorrectName = Words[0].str();
+ std::vector<llvm::StringMap<std::string>> MapList = {
+ HNOption.CString, HNOption.DerivedType, HNOption.PrimitiveType,
+ HNOption.UserDefinedType};
+
+ for (const auto &Map : MapList) {
+ for (const auto &Str : Map) {
+ if (Str.getValue() == CorrectName) {
+ Words.erase(Words.begin(), Words.begin() + 1);
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+const std::string IdentifierNamingCheck::HungarianNotation::getDataTypePrefix(
+ StringRef TypeName, const NamedDecl *ND,
+ const IdentifierNamingCheck::HungarianNotationOption &HNOption) const {
+ if (!ND || TypeName.empty())
+ return TypeName.str();
+
+ std::string ModifiedTypeName(TypeName);
+
+ // Derived types
+ std::string PrefixStr;
+ if (const auto *TD = dyn_cast<ValueDecl>(ND)) {
+ QualType QT = TD->getType();
+ if (QT->isFunctionPointerType()) {
+ PrefixStr = HNOption.DerivedType.lookup("FunctionPointer");
+ } else if (QT->isPointerType()) {
+ for (const auto &CStr : HNOption.CString) {
+ std::string Key = CStr.getKey().str();
+ if (ModifiedTypeName.find(Key) == 0) {
+ PrefixStr = CStr.getValue();
+ ModifiedTypeName = ModifiedTypeName.substr(
+ Key.size(), ModifiedTypeName.size() - Key.size());
+ break;
+ }
+ }
+ } else if (QT->isArrayType()) {
+ for (const auto &CStr : HNOption.CString) {
+ std::string Key = CStr.getKey().str();
+ if (ModifiedTypeName.find(Key) == 0) {
+ PrefixStr = CStr.getValue();
+ break;
+ }
+ }
+ if (PrefixStr.empty())
+ PrefixStr = HNOption.DerivedType.lookup("Array");
+ } else if (QT->isReferenceType()) {
+ size_t Pos = ModifiedTypeName.find_last_of("&");
+ if (Pos != std::string::npos)
+ ModifiedTypeName = ModifiedTypeName.substr(0, Pos);
+ }
+ }
+
+ // Pointers
+ size_t PtrCount = [&](std::string TypeName) -> size_t {
+ size_t Pos = TypeName.find('*');
+ size_t Count = 0;
+ for (; Pos < TypeName.length(); Pos++, Count++) {
+ if ('*' != TypeName[Pos])
+ break;
+ }
+ return Count;
+ }(ModifiedTypeName);
+ if (PtrCount > 0) {
+ ModifiedTypeName = [&](std::string Str, StringRef From, StringRef To) {
+ size_t StartPos = 0;
+ while ((StartPos = Str.find(From.data(), StartPos)) !=
+ std::string::npos) {
+ Str.replace(StartPos, From.size(), To.data());
+ StartPos += To.size();
+ }
+ return Str;
+ }(ModifiedTypeName, "*", "");
+ }
+
+ // Primitive types
+ if (PrefixStr.empty()) {
+ for (const auto &Type : HNOption.PrimitiveType) {
+ if (ModifiedTypeName == Type.getKey()) {
+ PrefixStr = Type.getValue();
+ break;
+ }
+ }
+ }
+
+ // User-Defined types
+ if (PrefixStr.empty()) {
+ for (const auto &Type : HNOption.UserDefinedType) {
+ if (ModifiedTypeName == Type.getKey()) {
+ PrefixStr = Type.getValue();
+ break;
+ }
+ }
+ }
+
+ for (size_t Idx = 0; Idx < PtrCount; Idx++)
+ PrefixStr.insert(0, HNOption.DerivedType.lookup("Pointer"));
+
+ return PrefixStr;
+}
+
+std::string IdentifierNamingCheck::HungarianNotation::getClassPrefix(
+ const CXXRecordDecl *CRD,
+ const IdentifierNamingCheck::HungarianNotationOption &HNOption) const {
+
+ if (CRD->isUnion())
+ return {};
+
+ if (CRD->isStruct() &&
+ !isOptionEnabled("TreatStructAsClass", HNOption.General))
+ return {};
+
+ return CRD->isAbstract() ? "I" : "C";
+}
+
+std::string IdentifierNamingCheck::HungarianNotation::getEnumPrefix(
+ const EnumConstantDecl *ECD) const {
+ std::string Name = ECD->getType().getAsString();
+ if (std::string::npos != Name.find("enum")) {
+ Name = Name.substr(strlen("enum"), Name.length() - strlen("enum"));
+ Name = Name.erase(0, Name.find_first_not_of(" "));
+ }
+
+ static llvm::Regex Splitter(
+ "([a-z0-9A-Z]*)(_+)|([A-Z]?[a-z0-9]+)([A-Z]|$)|([A-Z]+)([A-Z]|$)");
+
+ StringRef EnumName(Name);
+ SmallVector<StringRef, 8> Substrs;
+ EnumName.split(Substrs, "_", -1, false);
+
+ SmallVector<StringRef, 8> Words;
+ SmallVector<StringRef, 8> Groups;
+ for (auto Substr : Substrs) {
+ while (!Substr.empty()) {
+ Groups.clear();
+ if (!Splitter.match(Substr, &Groups))
+ break;
+
+ if (Groups[2].size() > 0) {
+ Words.push_back(Groups[1]);
+ Substr = Substr.substr(Groups[0].size());
+ } else if (Groups[3].size() > 0) {
+ Words.push_back(Groups[3]);
+ Substr = Substr.substr(Groups[0].size() - Groups[4].size());
+ } else if (Groups[5].size() > 0) {
+ Words.push_back(Groups[5]);
+ Substr = Substr.substr(Groups[0].size() - Groups[6].size());
+ }
+ }
+ }
+
+ std::string Initial;
+ for (StringRef Word : Words)
+ Initial += tolower(Word[0]);
+
+ return Initial;
+}
+
+void IdentifierNamingCheck::HungarianNotation::loadDefaultConfig(
+ IdentifierNamingCheck::HungarianNotationOption &HNOption) const {
+
+ // Options
+ static constexpr std::pair<StringRef, StringRef> General[] = {
+ {"TreatStructAsClass", "false"}};
+ for (const auto &G : General)
+ HNOption.General.try_emplace(G.first, G.second);
+
+ // Derived types
+ static constexpr std::pair<StringRef, StringRef> DerivedTypes[] = {
+ {"Array", "a"}, {"Pointer", "p"}, {"FunctionPointer", "fn"}};
+ for (const auto &DT : DerivedTypes)
+ HNOption.DerivedType.try_emplace(DT.first, DT.second);
+
+ // C strings
+ static constexpr std::pair<StringRef, StringRef> CStrings[] = {
+ {"char*", "sz"},
+ {"char[]", "sz"},
+ {"wchar_t*", "wsz"},
+ {"wchar_t[]", "wsz"}};
+ for (const auto &CStr : CStrings)
+ HNOption.CString.try_emplace(CStr.first, CStr.second);
+
+ // clang-format off
+ static constexpr std::pair<StringRef, StringRef> PrimitiveTypes[] = {
+ {"int8_t", "i8" },
+ {"int16_t", "i16" },
+ {"int32_t", "i32" },
+ {"int64_t", "i64" },
+ {"uint8_t", "u8" },
+ {"uint16_t", "u16" },
+ {"uint32_t", "u32" },
+ {"uint64_t", "u64" },
+ {"char8_t", "c8" },
+ {"char16_t", "c16" },
+ {"char32_t", "c32" },
+ {"float", "f" },
+ {"double", "d" },
+ {"char", "c" },
+ {"bool", "b" },
+ {"_Bool", "b" },
+ {"int", "i" },
+ {"size_t", "n" },
+ {"wchar_t", "wc" },
+ {"short int", "si" },
+ {"short", "s" },
+ {"signed int", "si" },
+ {"signed short", "ss" },
+ {"signed short int", "ssi" },
+ {"signed long long int", "slli"},
+ {"signed long long", "sll" },
+ {"signed long int", "sli" },
+ {"signed long", "sl" },
+ {"signed", "s" },
+ {"unsigned long long int", "ulli"},
+ {"unsigned long long", "ull" },
+ {"unsigned long int", "uli" },
+ {"unsigned long", "ul" },
+ {"unsigned short int", "usi" },
+ {"unsigned short", "us" },
+ {"unsigned int", "ui" },
+ {"unsigned", "u" },
+ {"long long int", "lli" },
+ {"long double", "ld" },
+ {"long long", "ll" },
+ {"long int", "li" },
+ {"long", "l" },
+ {"ptr
diff _t", "p" }};
+ // clang-format on
+ for (const auto &PT : PrimitiveTypes)
+ HNOption.PrimitiveType.try_emplace(PT.first, PT.second);
+
+ // clang-format off
+ static constexpr std::pair<StringRef, StringRef> UserDefinedTypes[] = {
+ // Windows data types
+ {"BOOL", "b" },
+ {"BOOLEAN", "b" },
+ {"BYTE", "by" },
+ {"CHAR", "c" },
+ {"UCHAR", "uc" },
+ {"SHORT", "s" },
+ {"USHORT", "us" },
+ {"WORD", "w" },
+ {"DWORD", "dw" },
+ {"DWORD32", "dw32"},
+ {"DWORD64", "dw64"},
+ {"LONG", "l" },
+ {"ULONG", "ul" },
+ {"ULONG32", "ul32"},
+ {"ULONG64", "ul64"},
+ {"ULONGLONG", "ull" },
+ {"HANDLE", "h" },
+ {"INT", "i" },
+ {"INT8", "i8" },
+ {"INT16", "i16" },
+ {"INT32", "i32" },
+ {"INT64", "i64" },
+ {"UINT", "ui" },
+ {"UINT8", "u8" },
+ {"UINT16", "u16" },
+ {"UINT32", "u32" },
+ {"UINT64", "u64" },
+ {"PVOID", "p" } };
+ // clang-format on
+ for (const auto &UDT : UserDefinedTypes)
+ HNOption.UserDefinedType.try_emplace(UDT.first, UDT.second);
+}
+
void IdentifierNamingCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
RenamerClangTidyCheck::storeOptions(Opts);
SmallString<64> StyleString;
@@ -194,6 +796,10 @@ void IdentifierNamingCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
continue;
StyleString = StyleNames[I];
size_t StyleSize = StyleString.size();
+
+ Options.store(Opts, (StyleString + "HungarianPrefix").str(),
+ Styles[I]->HPType);
+
StyleString.append("IgnoredRegexp");
Options.store(Opts, StyleString, Styles[I]->IgnoredRegexpStr);
StyleString.resize(StyleSize);
@@ -215,8 +821,11 @@ void IdentifierNamingCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
MainFileStyle->isIgnoringMainLikeFunction());
}
-static bool matchesStyle(StringRef Name,
- const IdentifierNamingCheck::NamingStyle &Style) {
+bool IdentifierNamingCheck::matchesStyle(
+ StringRef Type, StringRef Name,
+ const IdentifierNamingCheck::NamingStyle &Style,
+ const IdentifierNamingCheck::HungarianNotationOption &HNOption,
+ const NamedDecl *Decl) const {
static llvm::Regex Matchers[] = {
llvm::Regex("^.*$"),
llvm::Regex("^[a-z][a-z0-9_]*$"),
@@ -231,6 +840,11 @@ static bool matchesStyle(StringRef Name,
return false;
if (!Name.consume_back(Style.Suffix))
return false;
+ if (IdentifierNamingCheck::HungarianPrefixType::HPT_Off != Style.HPType) {
+ std::string HNPrefix = HungarianNotation.getPrefix(Decl, HNOption);
+ if (!Name.consume_front(HNPrefix))
+ return false;
+ }
// Ensure the name doesn't have any extra underscores beyond those specified
// in the prefix and suffix.
@@ -243,8 +857,11 @@ static bool matchesStyle(StringRef Name,
return true;
}
-static std::string fixupWithCase(StringRef Name,
- IdentifierNamingCheck::CaseType Case) {
+std::string IdentifierNamingCheck::fixupWithCase(
+ StringRef Type, StringRef Name, const Decl *D,
+ const IdentifierNamingCheck::NamingStyle &Style,
+ const IdentifierNamingCheck::HungarianNotationOption &HNOption,
+ IdentifierNamingCheck::CaseType Case) const {
static llvm::Regex Splitter(
"([a-z0-9A-Z]*)(_+)|([A-Z]?[a-z0-9]+)([A-Z]|$)|([A-Z]+)([A-Z]|$)");
@@ -275,6 +892,10 @@ static std::string fixupWithCase(StringRef Name,
if (Words.empty())
return Name.str();
+ if (IdentifierNamingCheck::HungarianPrefixType::HPT_Off != Style.HPType) {
+ HungarianNotation.removeDuplicatedPrefix(Words, HNOption);
+ }
+
SmallString<128> Fixup;
switch (Case) {
case IdentifierNamingCheck::CT_AnyCase:
@@ -340,8 +961,8 @@ static std::string fixupWithCase(StringRef Name,
return Fixup.str().str();
}
-static bool isParamInMainLikeFunction(const ParmVarDecl &ParmDecl,
- bool IncludeMainLike) {
+bool IdentifierNamingCheck::isParamInMainLikeFunction(
+ const ParmVarDecl &ParmDecl, bool IncludeMainLike) const {
const auto *FDecl =
dyn_cast_or_null<FunctionDecl>(ParmDecl.getParentFunctionOrMethod());
if (!FDecl)
@@ -404,29 +1025,46 @@ static bool isParamInMainLikeFunction(const ParmVarDecl &ParmDecl,
return Matcher.match(FDecl->getName());
}
-static std::string
-fixupWithStyle(StringRef Name,
- const IdentifierNamingCheck::NamingStyle &Style) {
+std::string IdentifierNamingCheck::fixupWithStyle(
+ StringRef Type, StringRef Name,
+ const IdentifierNamingCheck::NamingStyle &Style,
+ const IdentifierNamingCheck::HungarianNotationOption &HNOption,
+ const Decl *D) const {
Name.consume_front(Style.Prefix);
Name.consume_back(Style.Suffix);
- const std::string Fixed = fixupWithCase(
- Name, Style.Case.getValueOr(IdentifierNamingCheck::CaseType::CT_AnyCase));
+ std::string Fixed = fixupWithCase(
+ Type, Name, D, Style, HNOption,
+ Style.Case.getValueOr(IdentifierNamingCheck::CaseType::CT_AnyCase));
+
+ std::string HungarianPrefix;
+ using HungarianPrefixType = IdentifierNamingCheck::HungarianPrefixType;
+ if (HungarianPrefixType::HPT_Off != Style.HPType) {
+ HungarianPrefix = HungarianNotation.getPrefix(D, HNOption);
+ if (!HungarianPrefix.empty()) {
+ if (Style.HPType == HungarianPrefixType::HPT_LowerCase)
+ HungarianPrefix += "_";
+
+ if (Style.HPType == HungarianPrefixType::HPT_CamelCase)
+ Fixed[0] = toupper(Fixed[0]);
+ }
+ }
StringRef Mid = StringRef(Fixed).trim("_");
if (Mid.empty())
Mid = "_";
- return (Style.Prefix + Mid + Style.Suffix).str();
+
+ return (Style.Prefix + HungarianPrefix + Mid + Style.Suffix).str();
}
-static StyleKind findStyleKind(
+StyleKind IdentifierNamingCheck::findStyleKind(
const NamedDecl *D,
ArrayRef<llvm::Optional<IdentifierNamingCheck::NamingStyle>> NamingStyles,
- bool IgnoreMainLikeFunctions) {
+ bool IgnoreMainLikeFunctions) const {
assert(D && D->getIdentifier() && !D->getName().empty() && !D->isImplicit() &&
"Decl must be an explicit identifier with a name.");
if (isa<ObjCIvarDecl>(D) && NamingStyles[SK_ObjcIvar])
return SK_ObjcIvar;
-
+
if (isa<TypedefDecl>(D) && NamingStyles[SK_Typedef])
return SK_Typedef;
@@ -528,7 +1166,8 @@ static StyleKind findStyleKind(
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])
@@ -541,8 +1180,9 @@ static StyleKind findStyleKind(
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;
@@ -560,7 +1200,8 @@ static StyleKind findStyleKind(
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])
@@ -569,7 +1210,8 @@ static StyleKind findStyleKind(
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])
@@ -585,7 +1227,8 @@ static StyleKind findStyleKind(
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])
@@ -593,8 +1236,9 @@ static StyleKind findStyleKind(
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])
@@ -698,10 +1342,13 @@ static StyleKind findStyleKind(
return SK_Invalid;
}
-static llvm::Optional<RenamerClangTidyCheck::FailureInfo> getFailureInfo(
- StringRef Name, SourceLocation Location,
+llvm::Optional<RenamerClangTidyCheck::FailureInfo>
+IdentifierNamingCheck::getFailureInfo(
+ StringRef Type, StringRef Name, const NamedDecl *ND,
+ SourceLocation Location,
ArrayRef<llvm::Optional<IdentifierNamingCheck::NamingStyle>> NamingStyles,
- StyleKind SK, const SourceManager &SM, bool IgnoreFailedSplit) {
+ const IdentifierNamingCheck::HungarianNotationOption &HNOption,
+ StyleKind SK, const SourceManager &SM, bool IgnoreFailedSplit) const {
if (SK == SK_Invalid || !NamingStyles[SK])
return None;
@@ -709,14 +1356,15 @@ static llvm::Optional<RenamerClangTidyCheck::FailureInfo> getFailureInfo(
if (Style.IgnoredRegexp.isValid() && Style.IgnoredRegexp.match(Name))
return None;
- if (matchesStyle(Name, Style))
+ if (matchesStyle(Type, Name, Style, HNOption, ND))
return None;
std::string KindName =
- fixupWithCase(StyleNames[SK], IdentifierNamingCheck::CT_LowerCase);
+ fixupWithCase(Type, StyleNames[SK], ND, Style, HNOption,
+ IdentifierNamingCheck::CT_LowerCase);
std::replace(KindName.begin(), KindName.end(), '_', ' ');
- std::string Fixup = fixupWithStyle(Name, Style);
+ std::string Fixup = fixupWithStyle(Type, Name, Style, HNOption, ND);
if (StringRef(Fixup).equals(Name)) {
if (!IgnoreFailedSplit) {
LLVM_DEBUG(Location.print(llvm::dbgs(), SM);
@@ -738,7 +1386,9 @@ IdentifierNamingCheck::GetDeclFailureInfo(const NamedDecl *Decl,
if (!FileStyle.isActive())
return llvm::None;
- return getFailureInfo(Decl->getName(), Loc, FileStyle.getStyles(),
+ return getFailureInfo(HungarianNotation.getDeclTypeName(Decl),
+ Decl->getName(), Decl, Loc, FileStyle.getStyles(),
+ FileStyle.getHNOption(),
findStyleKind(Decl, FileStyle.getStyles(),
FileStyle.isIgnoringMainLikeFunction()),
SM, IgnoreFailedSplit);
@@ -752,9 +1402,9 @@ IdentifierNamingCheck::GetMacroFailureInfo(const Token &MacroNameTok,
if (!Style.isActive())
return llvm::None;
- return getFailureInfo(MacroNameTok.getIdentifierInfo()->getName(), Loc,
- Style.getStyles(), SK_MacroDefinition, SM,
- IgnoreFailedSplit);
+ return getFailureInfo("", MacroNameTok.getIdentifierInfo()->getName(), NULL,
+ Loc, Style.getStyles(), Style.getHNOption(),
+ SK_MacroDefinition, SM, IgnoreFailedSplit);
}
RenamerClangTidyCheck::DiagInfo
diff --git a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.h b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.h
index 565eb9d114742..ac8cfc8b4d51e 100644
--- a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.h
+++ b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.h
@@ -18,6 +18,8 @@ class MacroInfo;
namespace tidy {
namespace readability {
+enum StyleKind : int;
+
/// Checks for identifiers naming style mismatch.
///
/// This check will try to enforce coding guidelines on the identifiers naming.
@@ -48,11 +50,31 @@ class IdentifierNamingCheck final : public RenamerClangTidyCheck {
CT_CamelSnakeBack
};
+ enum HungarianPrefixType {
+ HPT_Off = 0,
+ HPT_On,
+ HPT_LowerCase,
+ HPT_CamelCase,
+ };
+
+ struct HungarianNotationOption {
+ HungarianNotationOption() : HPType(HungarianPrefixType::HPT_Off) {}
+
+ llvm::Optional<CaseType> Case;
+ HungarianPrefixType HPType;
+ llvm::StringMap<std::string> General;
+ llvm::StringMap<std::string> CString;
+ llvm::StringMap<std::string> PrimitiveType;
+ llvm::StringMap<std::string> UserDefinedType;
+ llvm::StringMap<std::string> DerivedType;
+ };
+
struct NamingStyle {
NamingStyle() = default;
NamingStyle(llvm::Optional<CaseType> Case, const std::string &Prefix,
- const std::string &Suffix, const std::string &IgnoredRegexpStr);
+ const std::string &Suffix, const std::string &IgnoredRegexpStr,
+ HungarianPrefixType HPType);
NamingStyle(const NamingStyle &O) = delete;
NamingStyle &operator=(NamingStyle &&O) = default;
NamingStyle(NamingStyle &&O) = default;
@@ -64,28 +86,104 @@ class IdentifierNamingCheck final : public RenamerClangTidyCheck {
// serialized
llvm::Regex IgnoredRegexp;
std::string IgnoredRegexpStr;
+
+ HungarianPrefixType HPType;
+ };
+
+ struct HungarianNotation {
+ public:
+ bool checkOptionValid(int StyleKindIndex, StringRef StyleString) const;
+ bool isOptionEnabled(StringRef OptionKey,
+ const llvm::StringMap<std::string> &StrMap) const;
+ void loadDefaultConfig(
+ IdentifierNamingCheck::HungarianNotationOption &HNOption) const;
+ void loadFileConfig(
+ const ClangTidyCheck::OptionsView &Options,
+ IdentifierNamingCheck::HungarianNotationOption &HNOption) const;
+
+ bool removeDuplicatedPrefix(
+ SmallVector<StringRef, 8> &Words,
+ const IdentifierNamingCheck::HungarianNotationOption &HNOption) const;
+
+ std::string getPrefix(
+ const Decl *D,
+ const IdentifierNamingCheck::HungarianNotationOption &HNOption) const;
+
+ const std::string getDataTypePrefix(
+ StringRef TypeName, const NamedDecl *ND,
+ const IdentifierNamingCheck::HungarianNotationOption &HNOption) const;
+
+ std::string getClassPrefix(
+ const CXXRecordDecl *CRD,
+ const IdentifierNamingCheck::HungarianNotationOption &HNOption) const;
+
+ std::string getEnumPrefix(const EnumConstantDecl *ECD) const;
+ std::string getDeclTypeName(const NamedDecl *ND) const;
};
struct FileStyle {
FileStyle() : IsActive(false), IgnoreMainLikeFunctions(false) {}
FileStyle(SmallVectorImpl<Optional<NamingStyle>> &&Styles,
- bool IgnoreMainLike)
- : Styles(std::move(Styles)), IsActive(true),
- IgnoreMainLikeFunctions(IgnoreMainLike) {}
+ HungarianNotationOption HNOption, bool IgnoreMainLike)
+ : Styles(std::move(Styles)), HNOption(std::move(HNOption)),
+ IsActive(true), IgnoreMainLikeFunctions(IgnoreMainLike) {}
ArrayRef<Optional<NamingStyle>> getStyles() const {
assert(IsActive);
return Styles;
}
+
+ const HungarianNotationOption &getHNOption() const {
+ assert(IsActive);
+ return HNOption;
+ }
+
bool isActive() const { return IsActive; }
bool isIgnoringMainLikeFunction() const { return IgnoreMainLikeFunctions; }
private:
SmallVector<Optional<NamingStyle>, 0> Styles;
+ HungarianNotationOption HNOption;
bool IsActive;
bool IgnoreMainLikeFunctions;
};
+ IdentifierNamingCheck::FileStyle
+ getFileStyleFromOptions(const ClangTidyCheck::OptionsView &Options) const;
+
+ bool
+ matchesStyle(StringRef Type, StringRef Name,
+ const IdentifierNamingCheck::NamingStyle &Style,
+ const IdentifierNamingCheck::HungarianNotationOption &HNOption,
+ const NamedDecl *Decl) const;
+
+ std::string
+ fixupWithCase(StringRef Type, StringRef Name, const Decl *D,
+ const IdentifierNamingCheck::NamingStyle &Style,
+ const IdentifierNamingCheck::HungarianNotationOption &HNOption,
+ IdentifierNamingCheck::CaseType Case) const;
+
+ std::string
+ fixupWithStyle(StringRef Type, StringRef Name,
+ const IdentifierNamingCheck::NamingStyle &Style,
+ const IdentifierNamingCheck::HungarianNotationOption &HNOption,
+ const Decl *D) const;
+
+ StyleKind findStyleKind(
+ const NamedDecl *D,
+ ArrayRef<llvm::Optional<IdentifierNamingCheck::NamingStyle>> NamingStyles,
+ bool IgnoreMainLikeFunctions) const;
+
+ llvm::Optional<RenamerClangTidyCheck::FailureInfo> getFailureInfo(
+ StringRef Type, StringRef Name, const NamedDecl *ND,
+ SourceLocation Location,
+ ArrayRef<llvm::Optional<IdentifierNamingCheck::NamingStyle>> NamingStyles,
+ const IdentifierNamingCheck::HungarianNotationOption &HNOption,
+ StyleKind SK, const SourceManager &SM, bool IgnoreFailedSplit) const;
+
+ bool isParamInMainLikeFunction(const ParmVarDecl &ParmDecl,
+ bool IncludeMainLike) const;
+
private:
llvm::Optional<FailureInfo>
GetDeclFailureInfo(const NamedDecl *Decl,
@@ -102,10 +200,11 @@ class IdentifierNamingCheck final : public RenamerClangTidyCheck {
/// StyleKind, for a given directory.
mutable llvm::StringMap<FileStyle> NamingStylesCache;
FileStyle *MainFileStyle;
- ClangTidyContext *const Context;
+ ClangTidyContext *Context;
const std::string CheckName;
const bool GetConfigPerFile;
const bool IgnoreFailedSplit;
+ HungarianNotation HungarianNotation;
};
} // namespace readability
diff --git a/clang-tools-extra/docs/clang-tidy/checks/readability-identifier-naming.rst b/clang-tools-extra/docs/clang-tidy/checks/readability-identifier-naming.rst
index b696abaabb3e2..23a1ff8e542f5 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/readability-identifier-naming.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/readability-identifier-naming.rst
@@ -35,50 +35,50 @@ Options
The following options are describe below:
- - :option:`AbstractClassCase`, :option:`AbstractClassPrefix`, :option:`AbstractClassSuffix`, :option:`AbstractClassIgnoredRegexp`
+ - :option:`AbstractClassCase`, :option:`AbstractClassPrefix`, :option:`AbstractClassSuffix`, :option:`AbstractClassIgnoredRegexp`, :option:`AbstractClassHungarianPrefix`
- :option:`AggressiveDependentMemberLookup`
- - :option:`ClassCase`, :option:`ClassPrefix`, :option:`ClassSuffix`, :option:`ClassIgnoredRegexp`
- - :option:`ClassConstantCase`, :option:`ClassConstantPrefix`, :option:`ClassConstantSuffix`, :option:`ClassConstantIgnoredRegexp`
- - :option:`ClassMemberCase`, :option:`ClassMemberPrefix`, :option:`ClassMemberSuffix`, :option:`ClassMemberIgnoredRegexp`
+ - :option:`ClassCase`, :option:`ClassPrefix`, :option:`ClassSuffix`, :option:`ClassIgnoredRegexp`, :option:`ClassHungarianPrefix`
+ - :option:`ClassConstantCase`, :option:`ClassConstantPrefix`, :option:`ClassConstantSuffix`, :option:`ClassConstantIgnoredRegexp`, :option:`ClassConstantHungarianPrefix`
+ - :option:`ClassMemberCase`, :option:`ClassMemberPrefix`, :option:`ClassMemberSuffix`, :option:`ClassMemberIgnoredRegexp`, :option:`ClassMemberHungarianPrefix`
- :option:`ClassMethodCase`, :option:`ClassMethodPrefix`, :option:`ClassMethodSuffix`, :option:`ClassMethodIgnoredRegexp`
- - :option:`ConstantCase`, :option:`ConstantPrefix`, :option:`ConstantSuffix`, :option:`ConstantIgnoredRegexp`
- - :option:`ConstantMemberCase`, :option:`ConstantMemberPrefix`, :option:`ConstantMemberSuffix`, :option:`ConstantMemberIgnoredRegexp`
- - :option:`ConstantParameterCase`, :option:`ConstantParameterPrefix`, :option:`ConstantParameterSuffix`, :option:`ConstantParameterIgnoredRegexp`
- - :option:`ConstantPointerParameterCase`, :option:`ConstantPointerParameterPrefix`, :option:`ConstantPointerParameterSuffix`, :option:`ConstantPointerParameterIgnoredRegexp`
+ - :option:`ConstantCase`, :option:`ConstantPrefix`, :option:`ConstantSuffix`, :option:`ConstantIgnoredRegexp`, :option:`ConstantHungarianPrefix`
+ - :option:`ConstantMemberCase`, :option:`ConstantMemberPrefix`, :option:`ConstantMemberSuffix`, :option:`ConstantMemberIgnoredRegexp`, :option:`ConstantMemberHungarianPrefix`
+ - :option:`ConstantParameterCase`, :option:`ConstantParameterPrefix`, :option:`ConstantParameterSuffix`, :option:`ConstantParameterIgnoredRegexp`, :option:`ConstantParameterHungarianPrefix`
+ - :option:`ConstantPointerParameterCase`, :option:`ConstantPointerParameterPrefix`, :option:`ConstantPointerParameterSuffix`, :option:`ConstantPointerParameterIgnoredRegexp`, :option:`ConstantPointerParameterHungarianPrefix`
- :option:`ConstexprFunctionCase`, :option:`ConstexprFunctionPrefix`, :option:`ConstexprFunctionSuffix`, :option:`ConstexprFunctionIgnoredRegexp`
- :option:`ConstexprMethodCase`, :option:`ConstexprMethodPrefix`, :option:`ConstexprMethodSuffix`, :option:`ConstexprMethodIgnoredRegexp`
- - :option:`ConstexprVariableCase`, :option:`ConstexprVariablePrefix`, :option:`ConstexprVariableSuffix`, :option:`ConstexprVariableIgnoredRegexp`
+ - :option:`ConstexprVariableCase`, :option:`ConstexprVariablePrefix`, :option:`ConstexprVariableSuffix`, :option:`ConstexprVariableIgnoredRegexp`, :option:`ConstexprVariableHungarianPrefix`
- :option:`EnumCase`, :option:`EnumPrefix`, :option:`EnumSuffix`, :option:`EnumIgnoredRegexp`
- - :option:`EnumConstantCase`, :option:`EnumConstantPrefix`, :option:`EnumConstantSuffix`, :option:`EnumConstantIgnoredRegexp`
+ - :option:`EnumConstantCase`, :option:`EnumConstantPrefix`, :option:`EnumConstantSuffix`, :option:`EnumConstantIgnoredRegexp`, :option:`EnumConstantHungarianPrefix`
- :option:`FunctionCase`, :option:`FunctionPrefix`, :option:`FunctionSuffix`, :option:`FunctionIgnoredRegexp`
- :option:`GetConfigPerFile`
- - :option:`GlobalConstantCase`, :option:`GlobalConstantPrefix`, :option:`GlobalConstantSuffix`, :option:`GlobalConstantIgnoredRegexp`
- - :option:`GlobalConstantPointerCase`, :option:`GlobalConstantPointerPrefix`, :option:`GlobalConstantPointerSuffix`, :option:`GlobalConstantPointerIgnoredRegexp`
+ - :option:`GlobalConstantCase`, :option:`GlobalConstantPrefix`, :option:`GlobalConstantSuffix`, :option:`GlobalConstantIgnoredRegexp`, :option:`GlobalConstantHungarianPrefix`
+ - :option:`GlobalConstantPointerCase`, :option:`GlobalConstantPointerPrefix`, :option:`GlobalConstantPointerSuffix`, :option:`GlobalConstantPointerIgnoredRegexp`, :option:`GlobalConstantPointerHungarianPrefix`
- :option:`GlobalFunctionCase`, :option:`GlobalFunctionPrefix`, :option:`GlobalFunctionSuffix`, :option:`GlobalFunctionIgnoredRegexp`
- - :option:`GlobalPointerCase`, :option:`GlobalPointerPrefix`, :option:`GlobalPointerSuffix`, :option:`GlobalPointerIgnoredRegexp`
- - :option:`GlobalVariableCase`, :option:`GlobalVariablePrefix`, :option:`GlobalVariableSuffix`, :option:`GlobalVariableIgnoredRegexp`
+ - :option:`GlobalPointerCase`, :option:`GlobalPointerPrefix`, :option:`GlobalPointerSuffix`, :option:`GlobalPointerIgnoredRegexp`, :option:`GlobalPointerHungarianPrefix`
+ - :option:`GlobalVariableCase`, :option:`GlobalVariablePrefix`, :option:`GlobalVariableSuffix`, :option:`GlobalVariableIgnoredRegexp`, :option:`GlobalVariableHungarianPrefix`
- :option:`IgnoreMainLikeFunctions`
- :option:`InlineNamespaceCase`, :option:`InlineNamespacePrefix`, :option:`InlineNamespaceSuffix`, :option:`InlineNamespaceIgnoredRegexp`
- - :option:`LocalConstantCase`, :option:`LocalConstantPrefix`, :option:`LocalConstantSuffix`, :option:`LocalConstantIgnoredRegexp`
- - :option:`LocalConstantPointerCase`, :option:`LocalConstantPointerPrefix`, :option:`LocalConstantPointerSuffix`, :option:`LocalConstantPointerIgnoredRegexp`
- - :option:`LocalPointerCase`, :option:`LocalPointerPrefix`, :option:`LocalPointerSuffix`, :option:`LocalPointerIgnoredRegexp`
- - :option:`LocalVariableCase`, :option:`LocalVariablePrefix`, :option:`LocalVariableSuffix`, :option:`LocalVariableIgnoredRegexp`
+ - :option:`LocalConstantCase`, :option:`LocalConstantPrefix`, :option:`LocalConstantSuffix`, :option:`LocalConstantIgnoredRegexp`, :option:`LocalConstantHungarianPrefix`
+ - :option:`LocalConstantPointerCase`, :option:`LocalConstantPointerPrefix`, :option:`LocalConstantPointerSuffix`, :option:`LocalConstantPointerIgnoredRegexp`, :option:`LocalConstantPointerHungarianPrefix`
+ - :option:`LocalPointerCase`, :option:`LocalPointerPrefix`, :option:`LocalPointerSuffix`, :option:`LocalPointerIgnoredRegexp`, :option:`LocalPointerHungarianPrefix`
+ - :option:`LocalVariableCase`, :option:`LocalVariablePrefix`, :option:`LocalVariableSuffix`, :option:`LocalVariableIgnoredRegexp`, :option:`LocalVariableHungarianPrefix`
- :option:`MacroDefinitionCase`, :option:`MacroDefinitionPrefix`, :option:`MacroDefinitionSuffix`, :option:`MacroDefinitionIgnoredRegexp`
- - :option:`MemberCase`, :option:`MemberPrefix`, :option:`MemberSuffix`, :option:`MemberIgnoredRegexp`
+ - :option:`MemberCase`, :option:`MemberPrefix`, :option:`MemberSuffix`, :option:`MemberIgnoredRegexp`, :option:`MemberHungarianPrefix`
- :option:`MethodCase`, :option:`MethodPrefix`, :option:`MethodSuffix`, :option:`MethodIgnoredRegexp`
- :option:`NamespaceCase`, :option:`NamespacePrefix`, :option:`NamespaceSuffix`, :option:`NamespaceIgnoredRegexp`
- - :option:`ParameterCase`, :option:`ParameterPrefix`, :option:`ParameterSuffix`, :option:`ParameterIgnoredRegexp`
+ - :option:`ParameterCase`, :option:`ParameterPrefix`, :option:`ParameterSuffix`, :option:`ParameterIgnoredRegexp`, :option:`ParameterHungarianPrefix`
- :option:`ParameterPackCase`, :option:`ParameterPackPrefix`, :option:`ParameterPackSuffix`, :option:`ParameterPackIgnoredRegexp`
- - :option:`PointerParameterCase`, :option:`PointerParameterPrefix`, :option:`PointerParameterSuffix`, :option:`PointerParameterIgnoredRegexp`
- - :option:`PrivateMemberCase`, :option:`PrivateMemberPrefix`, :option:`PrivateMemberSuffix`, :option:`PrivateMemberIgnoredRegexp`
+ - :option:`PointerParameterCase`, :option:`PointerParameterPrefix`, :option:`PointerParameterSuffix`, :option:`PointerParameterIgnoredRegexp`, :option:`PointerParameterHungarianPrefix`
+ - :option:`PrivateMemberCase`, :option:`PrivateMemberPrefix`, :option:`PrivateMemberSuffix`, :option:`PrivateMemberIgnoredRegexp`, :option:`PrivateMemberHungarianPrefix`
- :option:`PrivateMethodCase`, :option:`PrivateMethodPrefix`, :option:`PrivateMethodSuffix`, :option:`PrivateMethodIgnoredRegexp`
- - :option:`ProtectedMemberCase`, :option:`ProtectedMemberPrefix`, :option:`ProtectedMemberSuffix`, :option:`ProtectedMemberIgnoredRegexp`
+ - :option:`ProtectedMemberCase`, :option:`ProtectedMemberPrefix`, :option:`ProtectedMemberSuffix`, :option:`ProtectedMemberIgnoredRegexp`, :option:`ProtectedMemberHungarianPrefix`
- :option:`ProtectedMethodCase`, :option:`ProtectedMethodPrefix`, :option:`ProtectedMethodSuffix`, :option:`ProtectedMethodIgnoredRegexp`
- - :option:`PublicMemberCase`, :option:`PublicMemberPrefix`, :option:`PublicMemberSuffix`, :option:`PublicMemberIgnoredRegexp`
+ - :option:`PublicMemberCase`, :option:`PublicMemberPrefix`, :option:`PublicMemberSuffix`, :option:`PublicMemberIgnoredRegexp`, :option:`PublicMemberHungarianPrefix`
- :option:`PublicMethodCase`, :option:`PublicMethodPrefix`, :option:`PublicMethodSuffix`, :option:`PublicMethodIgnoredRegexp`
- :option:`ScopedEnumConstantCase`, :option:`ScopedEnumConstantPrefix`, :option:`ScopedEnumConstantSuffix`, :option:`ScopedEnumConstantIgnoredRegexp`
- - :option:`StaticConstantCase`, :option:`StaticConstantPrefix`, :option:`StaticConstantSuffix`, :option:`StaticConstantIgnoredRegexp`
- - :option:`StaticVariableCase`, :option:`StaticVariablePrefix`, :option:`StaticVariableSuffix`, :option:`StaticVariableIgnoredRegexp`
+ - :option:`StaticConstantCase`, :option:`StaticConstantPrefix`, :option:`StaticConstantSuffix`, :option:`StaticConstantIgnoredRegexp`, :option:`StaticConstantHungarianPrefix`
+ - :option:`StaticVariableCase`, :option:`StaticVariablePrefix`, :option:`StaticVariableSuffix`, :option:`StaticVariableIgnoredRegexp`, :option:`StaticVariableHungarianPrefix`
- :option:`StructCase`, :option:`StructPrefix`, :option:`StructSuffix`, :option:`StructIgnoredRegexp`
- :option:`TemplateParameterCase`, :option:`TemplateParameterPrefix`, :option:`TemplateParameterSuffix`, :option:`TemplateParameterIgnoredRegexp`
- :option:`TemplateTemplateParameterCase`, :option:`TemplateTemplateParameterPrefix`, :option:`TemplateTemplateParameterSuffix`, :option:`TemplateTemplateParameterIgnoredRegexp`
@@ -87,7 +87,7 @@ The following options are describe below:
- :option:`TypeTemplateParameterCase`, :option:`TypeTemplateParameterPrefix`, :option:`TypeTemplateParameterSuffix`, :option:`TypeTemplateParameterIgnoredRegexp`
- :option:`UnionCase`, :option:`UnionPrefix`, :option:`UnionSuffix`, :option:`UnionIgnoredRegexp`
- :option:`ValueTemplateParameterCase`, :option:`ValueTemplateParameterPrefix`, :option:`ValueTemplateParameterSuffix`, :option:`ValueTemplateParameterIgnoredRegexp`
- - :option:`VariableCase`, :option:`VariablePrefix`, :option:`VariableSuffix`, :option:`VariableIgnoredRegexp`
+ - :option:`VariableCase`, :option:`VariablePrefix`, :option:`VariableSuffix`, :option:`VariableIgnoredRegexp`, :option:`VariableHungarianPrefix`
- :option:`VirtualMethodCase`, :option:`VirtualMethodPrefix`, :option:`VirtualMethodSuffix`, :option:`VirtualMethodIgnoredRegexp`
.. option:: AbstractClassCase
@@ -110,11 +110,18 @@ The following options are describe below:
When defined, the check will ensure abstract class names will add the
suffix with the given value (regardless of casing).
+.. option:: AbstractClassHungarianPrefix
+
+ When enabled, the check ensures that the declared identifier will
+ have a Hungarian notation prefix based on the declared type.
+
For example using values of:
- AbstractClassCase of ``lower_case``
- AbstractClassPrefix of ``pre_``
- AbstractClassSuffix of ``_post``
+ - AbstractClassHungarianPrefix of ``On``
+
Identifies and/or transforms abstract class names as follows:
@@ -214,11 +221,17 @@ After if AggressiveDependentMemberLookup is `true`:
When defined, the check will ensure class names will add the
suffix with the given value (regardless of casing).
+.. option:: ClassHungarianPrefix
+
+ When enabled, the check ensures that the declared identifier will
+ have a Hungarian notation prefix based on the declared type.
+
For example using values of:
- ClassCase of ``lower_case``
- ClassPrefix of ``pre_``
- ClassSuffix of ``_post``
+ - ClassHungarianPrefix of ``On``
Identifies and/or transforms class names as follows:
@@ -262,11 +275,17 @@ After:
When defined, the check will ensure class constant names will add the
suffix with the given value (regardless of casing).
+.. option:: ClassConstantHungarianPrefix
+
+ When enabled, the check ensures that the declared identifier will
+ have a Hungarian notation prefix based on the declared type.
+
For example using values of:
- ClassConstantCase of ``lower_case``
- ClassConstantPrefix of ``pre_``
- ClassConstantSuffix of ``_post``
+ - ClassConstantHungarianPrefix of ``On``
Identifies and/or transforms class constant names as follows:
@@ -308,11 +327,17 @@ After:
When defined, the check will ensure class member names will add the
suffix with the given value (regardless of casing).
+.. option:: ClassMemberHungarianPrefix
+
+ When enabled, the check ensures that the declared identifier will
+ have a Hungarian notation prefix based on the declared type.
+
For example using values of:
- ClassMemberCase of ``lower_case``
- ClassMemberPrefix of ``pre_``
- ClassMemberSuffix of ``_post``
+ - ClassMemberHungarianPrefix of ``On``
Identifies and/or transforms class member names as follows:
@@ -400,11 +425,17 @@ After:
When defined, the check will ensure constant names will add the
suffix with the given value (regardless of casing).
+.. option:: ConstantHungarianPrefix
+
+ When enabled, the check ensures that the declared identifier will
+ have a Hungarian notation prefix based on the declared type.
+
For example using values of:
- ConstantCase of ``lower_case``
- ConstantPrefix of ``pre_``
- ConstantSuffix of ``_post``
+ - ConstantHungarianPrefix of ``On``
Identifies and/or transforms constant names as follows:
@@ -440,11 +471,17 @@ After:
When defined, the check will ensure constant member names will add the
suffix with the given value (regardless of casing).
+.. option:: ConstantMemberHungarianPrefix
+
+ When enabled, the check ensures that the declared identifier will
+ have a Hungarian notation prefix based on the declared type.
+
For example using values of:
- ConstantMemberCase of ``lower_case``
- ConstantMemberPrefix of ``pre_``
- ConstantMemberSuffix of ``_post``
+ - ConstantMemberHungarianPrefix of ``On``
Identifies and/or transforms constant member names as follows:
@@ -484,11 +521,17 @@ After:
When defined, the check will ensure constant parameter names will add the
suffix with the given value (regardless of casing).
+.. option:: ConstantParameterHungarianPrefix
+
+ When enabled, the check ensures that the declared identifier will
+ have a Hungarian notation prefix based on the declared type.
+
For example using values of:
- ConstantParameterCase of ``lower_case``
- ConstantParameterPrefix of ``pre_``
- ConstantParameterSuffix of ``_post``
+ - ConstantParameterHungarianPrefix of ``On``
Identifies and/or transforms constant parameter names as follows:
@@ -524,11 +567,17 @@ After:
When defined, the check will ensure constant pointer parameter names will add the
suffix with the given value (regardless of casing).
+.. option:: ConstantPointerParameterHungarianPrefix
+
+ When enabled, the check ensures that the declared identifier will
+ have a Hungarian notation prefix based on the declared type.
+
For example using values of:
- ConstantPointerParameterCase of ``lower_case``
- ConstantPointerParameterPrefix of ``pre_``
- ConstantPointerParameterSuffix of ``_post``
+ - ConstantPointerParameterHungarianPrefix of ``On``
Identifies and/or transforms constant pointer parameter names as follows:
@@ -650,11 +699,17 @@ After:
When defined, the check will ensure constexpr variable names will add the
suffix with the given value (regardless of casing).
+.. option:: ConstexprVariableHungarianPrefix
+
+ When enabled, the check ensures that the declared identifier will
+ have a Hungarian notation prefix based on the declared type.
+
For example using values of:
- ConstexprVariableCase of ``lower_case``
- ConstexprVariablePrefix of ``pre_``
- ConstexprVariableSuffix of ``_post``
+ - ConstexprVariableHungarianPrefix of ``On``
Identifies and/or transforms constexpr variable names as follows:
@@ -730,11 +785,17 @@ After:
When defined, the check will ensure enumeration constant names will add the
suffix with the given value (regardless of casing).
+.. option:: EnumConstantHungarianPrefix
+
+ When enabled, the check ensures that the declared identifier will
+ have a Hungarian notation prefix based on the declared type.
+
For example using values of:
- EnumConstantCase of ``lower_case``
- EnumConstantPrefix of ``pre_``
- EnumConstantSuffix of ``_post``
+ - EnumConstantHungarianPrefix of ``On``
Identifies and/or transforms enumeration constant names as follows:
@@ -817,11 +878,17 @@ After:
When defined, the check will ensure global constant names will add the
suffix with the given value (regardless of casing).
+.. option:: GlobalConstantHungarianPrefix
+
+ When enabled, the check ensures that the declared identifier will
+ have a Hungarian notation prefix based on the declared type.
+
For example using values of:
- GlobalConstantCase of ``lower_case``
- GlobalConstantPrefix of ``pre_``
- GlobalConstantSuffix of ``_post``
+ - GlobalConstantHungarianPrefix of ``On``
Identifies and/or transforms global constant names as follows:
@@ -857,11 +924,17 @@ After:
When defined, the check will ensure global constant pointer names will add the
suffix with the given value (regardless of casing).
+.. option:: GlobalConstantPointerHungarianPrefix
+
+ When enabled, the check ensures that the declared identifier will
+ have a Hungarian notation prefix based on the declared type.
+
For example using values of:
- GlobalConstantPointerCase of ``lower_case``
- GlobalConstantPointerPrefix of ``pre_``
- GlobalConstantPointerSuffix of ``_post``
+ - GlobalConstantPointerHungarianPrefix of ``On``
Identifies and/or transforms global constant pointer names as follows:
@@ -937,11 +1010,17 @@ After:
When defined, the check will ensure global pointer names will add the
suffix with the given value (regardless of casing).
+.. option:: GlobalPointerHungarianPrefix
+
+ When enabled, the check ensures that the declared identifier will
+ have a Hungarian notation prefix based on the declared type.
+
For example using values of:
- GlobalPointerCase of ``lower_case``
- GlobalPointerPrefix of ``pre_``
- GlobalPointerSuffix of ``_post``
+ - GlobalPointerHungarianPrefix of ``On``
Identifies and/or transforms global pointer names as follows:
@@ -977,11 +1056,17 @@ After:
When defined, the check will ensure global variable names will add the
suffix with the given value (regardless of casing).
+.. option:: GlobalVariableHungarianPrefix
+
+ When enabled, the check ensures that the declared identifier will
+ have a Hungarian notation prefix based on the declared type.
+
For example using values of:
- GlobalVariableCase of ``lower_case``
- GlobalVariablePrefix of ``pre_``
- GlobalVariableSuffix of ``_post``
+ - GlobalVariableHungarianPrefix of ``On``
Identifies and/or transforms global variable names as follows:
@@ -1071,11 +1156,17 @@ After:
When defined, the check will ensure local constant names will add the
suffix with the given value (regardless of casing).
+.. option:: LocalConstantHungarianPrefix
+
+ When enabled, the check ensures that the declared identifier will
+ have a Hungarian notation prefix based on the declared type.
+
For example using values of:
- LocalConstantCase of ``lower_case``
- LocalConstantPrefix of ``pre_``
- LocalConstantSuffix of ``_post``
+ - LocalConstantHungarianPrefix of ``On``
Identifies and/or transforms local constant names as follows:
@@ -1111,11 +1202,17 @@ After:
When defined, the check will ensure local constant pointer names will add the
suffix with the given value (regardless of casing).
+.. option:: LocalConstantPointerHungarianPrefix
+
+ When enabled, the check ensures that the declared identifier will
+ have a Hungarian notation prefix based on the declared type.
+
For example using values of:
- LocalConstantPointerCase of ``lower_case``
- LocalConstantPointerPrefix of ``pre_``
- LocalConstantPointerSuffix of ``_post``
+ - LocalConstantPointerHungarianPrefix of ``On``
Identifies and/or transforms local constant pointer names as follows:
@@ -1151,11 +1248,17 @@ After:
When defined, the check will ensure local pointer names will add the
suffix with the given value (regardless of casing).
+.. option:: LocalPointerHungarianPrefix
+
+ When enabled, the check ensures that the declared identifier will
+ have a Hungarian notation prefix based on the declared type.
+
For example using values of:
- LocalPointerCase of ``lower_case``
- LocalPointerPrefix of ``pre_``
- LocalPointerSuffix of ``_post``
+ - LocalPointerHungarianPrefix of ``On``
Identifies and/or transforms local pointer names as follows:
@@ -1199,11 +1302,17 @@ camel case check applied to other variables.
When defined, the check will ensure local variable names will add the
suffix with the given value (regardless of casing).
+.. option:: LocalVariableHungarianPrefix
+
+ When enabled, the check ensures that the declared identifier will
+ have a Hungarian notation prefix based on the declared type.
+
For example using values of:
- LocalVariableCase of ``lower_case``
- LocalVariablePrefix of ``pre_``
- LocalVariableSuffix of ``_post``
+ - LocalVariableHungarianPrefix of ``On``
Identifies and/or transforms local variable names as follows:
@@ -1282,11 +1391,17 @@ using the ``-D`` flag.
When defined, the check will ensure member names will add the
suffix with the given value (regardless of casing).
+.. option:: MemberHungarianPrefix
+
+ When enabled, the check ensures that the declared identifier will
+ have a Hungarian notation prefix based on the declared type.
+
For example using values of:
- MemberCase of ``lower_case``
- MemberPrefix of ``pre_``
- MemberSuffix of ``_post``
+ - MemberHungarianPrefix of ``On``
Identifies and/or transforms member names as follows:
@@ -1414,11 +1529,17 @@ After:
When defined, the check will ensure parameter names will add the
suffix with the given value (regardless of casing).
+.. option:: ParameterHungarianPrefix
+
+ When enabled, the check ensures that the declared identifier will
+ have a Hungarian notation prefix based on the declared type.
+
For example using values of:
- ParameterCase of ``lower_case``
- ParameterPrefix of ``pre_``
- ParameterSuffix of ``_post``
+ - ParameterHungarianPrefix of ``On``
Identifies and/or transforms parameter names as follows:
@@ -1498,11 +1619,17 @@ After:
When defined, the check will ensure pointer parameter names will add the
suffix with the given value (regardless of casing).
+.. option:: PointerParameterHungarianPrefix
+
+ When enabled, the check ensures that the declared identifier will
+ have a Hungarian notation prefix based on the declared type.
+
For example using values of:
- PointerParameterCase of ``lower_case``
- PointerParameterPrefix of ``pre_``
- PointerParameterSuffix of ``_post``
+ - PointerParameterHungarianPrefix of ``On``
Identifies and/or transforms pointer parameter names as follows:
@@ -1538,11 +1665,17 @@ After:
When defined, the check will ensure private member names will add the
suffix with the given value (regardless of casing).
+.. option:: PrivateMemberHungarianPrefix
+
+ When enabled, the check ensures that the declared identifier will
+ have a Hungarian notation prefix based on the declared type.
+
For example using values of:
- PrivateMemberCase of ``lower_case``
- PrivateMemberPrefix of ``pre_``
- PrivateMemberSuffix of ``_post``
+ - PrivateMemberHungarianPrefix of ``On``
Identifies and/or transforms private member names as follows:
@@ -1630,11 +1763,17 @@ After:
When defined, the check will ensure protected member names will add the
suffix with the given value (regardless of casing).
+.. option:: ProtectedMemberHungarianPrefix
+
+ When enabled, the check ensures that the declared identifier will
+ have a Hungarian notation prefix based on the declared type.
+
For example using values of:
- ProtectedMemberCase of ``lower_case``
- ProtectedMemberPrefix of ``pre_``
- ProtectedMemberSuffix of ``_post``
+ - ProtectedMemberHungarianPrefix of ``On``
Identifies and/or transforms protected member names as follows:
@@ -1722,11 +1861,17 @@ After:
When defined, the check will ensure public member names will add the
suffix with the given value (regardless of casing).
+.. option:: PublicMemberHungarianPrefix
+
+ When enabled, the check ensures that the declared identifier will
+ have a Hungarian notation prefix based on the declared type.
+
For example using values of:
- PublicMemberCase of ``lower_case``
- PublicMemberPrefix of ``pre_``
- PublicMemberSuffix of ``_post``
+ - PublicMemberHungarianPrefix of ``On``
Identifies and/or transforms public member names as follows:
@@ -1814,11 +1959,17 @@ After:
When defined, the check will ensure scoped enum constant names will add the
suffix with the given value (regardless of casing).
+.. option:: ScopedEnumConstantHungarianPrefix
+
+ When enabled, the check ensures that the declared identifier will
+ have a Hungarian notation prefix based on the declared type.
+
For example using values of:
- ScopedEnumConstantCase of ``lower_case``
- ScopedEnumConstantPrefix of ``pre_``
- ScopedEnumConstantSuffix of ``_post``
+ - ScopedEnumConstantHungarianPrefix of ``On``
Identifies and/or transforms enumeration constant names as follows:
@@ -1854,11 +2005,17 @@ After:
When defined, the check will ensure static constant names will add the
suffix with the given value (regardless of casing).
+.. option:: StaticConstantHungarianPrefix
+
+ When enabled, the check ensures that the declared identifier will
+ have a Hungarian notation prefix based on the declared type.
+
For example using values of:
- StaticConstantCase of ``lower_case``
- StaticConstantPrefix of ``pre_``
- StaticConstantSuffix of ``_post``
+ - StaticConstantHungarianPrefix of ``On``
Identifies and/or transforms static constant names as follows:
@@ -1894,11 +2051,17 @@ After:
When defined, the check will ensure static variable names will add the
suffix with the given value (regardless of casing).
+.. option:: StaticVariableHungarianPrefix
+
+ When enabled, the check ensures that the declared identifier will
+ have a Hungarian notation prefix based on the declared type.
+
For example using values of:
- StaticVariableCase of ``lower_case``
- StaticVariablePrefix of ``pre_``
- StaticVariableSuffix of ``_post``
+ - StaticVariableHungarianPrefix of ``On``
Identifies and/or transforms static variable names as follows:
@@ -2272,11 +2435,17 @@ After:
When defined, the check will ensure variable names will add the
suffix with the given value (regardless of casing).
+.. option:: VariableHungarianPrefix
+
+ When enabled, the check ensures that the declared identifier will
+ have a Hungarian notation prefix based on the declared type.
+
For example using values of:
- VariableCase of ``lower_case``
- VariablePrefix of ``pre_``
- VariableSuffix of ``_post``
+ - VariableHungarianPrefix of ``On``
Identifies and/or transforms variable names as follows:
@@ -2337,3 +2506,239 @@ After:
public:
virtual int pre_member_function_post();
}
+
+
+The default mapping table of Hungarian Notation
+-----------------------------------------------
+
+In Hungarian notation, a variable name starts with a group of lower-case
+letters which are mnemonics for the type or purpose of that variable, followed
+by whatever name the programmer has chosen; this last part is sometimes
+distinguished as the given name. The first character of the given name can be
+capitalized to separate it from the type indicators (see also CamelCase).
+Otherwise the case of this character denotes scope.
+
+The following table is the default mapping table of Hungarian Notation which
+maps Decl to its prefix string. You can also have your own style in config file.
+
+================= ============== ====================== ============== =========== ==============
+Primitive Types Microsoft data types
+---------------------------------------------------------------------- --------------------------
+ Type Prefix Type Prefix Type Prefix
+================= ============== ====================== ============== =========== ==============
+int8_t i8 signed int si BOOL b
+int16_t i16 signed short ss BOOLEAN b
+int32_t i32 signed short int ssi BYTE by
+int64_t i64 signed long long int slli CHAR c
+uint8_t u8 signed long long sll UCHAR uc
+uint16_t u16 signed long int sli SHORT s
+uint32_t u32 signed long sl USHORT us
+uint64_t u64 signed s WORD w
+char8_t c8 unsigned long long int ulli DWORD dw
+char16_t c16 unsigned long long ull DWORD32 dw32
+char32_t c32 unsigned long int uli DWORD64 dw64
+float f unsigned long ul LONG l
+double d unsigned short int usi ULONG ul
+char c unsigned short us ULONG32 ul32
+bool b unsigned int ui ULONG64 ul64
+_Bool b unsigned u ULONGLONG ull
+int i long long int lli HANDLE h
+size_t n long double ld INT i
+short s long long ll INT8 i8
+signed i long int li INT16 i16
+unsigned u long l INT32 i32
+long l ptr
diff _t p INT64 i64
+long long ll UINT ui
+unsigned long ul UINT8 u8
+long double ld UINT16 u16
+ptr
diff _t p UINT32 u32
+wchar_t wc UINT64 u64
+short int si PVOID p
+short s
+================= ============== ====================== ============== =========== ==============
+
+**There are more trivial options for Hungarian Notation:**
+
+**HungarianNotation.General.***
+ Options are not belonging to any specific Decl.
+
+**HungarianNotation.CString.***
+ Options for NULL-terminated string.
+
+**HungarianNotation.DerivedType.***
+ Options for derived types.
+
+**HungarianNotation.PrimitiveType.***
+ Options for primitive types.
+
+**HungarianNotation.UserDefinedType.***
+ Options for user-defined types.
+
+
+Options for Hungarian Notation
+------------------------------
+
+- :option:`HungarianNotation.General.TreatStructAsClass`
+
+- :option:`HungarianNotation.DerivedType.Array`
+- :option:`HungarianNotation.DerivedType.Pointer`
+- :option:`HungarianNotation.DerivedType.FunctionPointer`
+
+- :option:`HungarianNotation.CString.CharPrinter`
+- :option:`HungarianNotation.CString.CharArray`
+- :option:`HungarianNotation.CString.WideCharPrinter`
+- :option:`HungarianNotation.CString.WideCharArray`
+
+- :option:`HungarianNotation.PrimitiveType.*`
+- :option:`HungarianNotation.UserDefinedType.*`
+
+.. option:: HungarianNotation.General.TreatStructAsClass
+
+ When defined, the check will treat naming of struct as a class.
+ The default value is `false`.
+
+.. option:: HungarianNotation.DerivedType.Array
+
+ When defined, the check will ensure variable name will add the prefix with
+ the given string. The default prefix is `a`.
+
+.. option:: HungarianNotation.DerivedType.Pointer
+
+ When defined, the check will ensure variable name will add the prefix with
+ the given string. The default prefix is `p`.
+
+.. option:: HungarianNotation.DerivedType.FunctionPointer
+
+ When defined, the check will ensure variable name will add the prefix with
+ the given string. The default prefix is `fn`.
+
+
+Before:
+
+.. code-block:: c++
+
+ // Array
+ int DataArray[2] = {0};
+
+ // Pointer
+ void *DataBuffer = NULL;
+
+ // FunctionPointer
+ typedef void (*FUNC_PTR)();
+ FUNC_PTR FuncPtr = NULL;
+
+After:
+
+.. code-block:: c++
+
+ // Array
+ int aDataArray[2] = {0};
+
+ // Pointer
+ void *pDataBuffer = NULL;
+
+ // FunctionPointer
+ typedef void (*FUNC_PTR)();
+ FUNC_PTR fnFuncPtr = NULL;
+
+
+.. option:: HungarianNotation.CString.CharPrinter
+
+ When defined, the check will ensure variable name will add the prefix with
+ the given string. The default prefix is `sz`.
+
+.. option:: HungarianNotation.CString.CharArray
+
+ When defined, the check will ensure variable name will add the prefix with
+ the given string. The default prefix is `sz`.
+
+.. option:: HungarianNotation.CString.WideCharPrinter
+
+ When defined, the check will ensure variable name will add the prefix with
+ the given string. The default prefix is `wsz`.
+
+.. option:: HungarianNotation.CString.WideCharArray
+
+ When defined, the check will ensure variable name will add the prefix with
+ the given string. The default prefix is `wsz`.
+
+
+Before:
+
+.. code-block:: c++
+
+ // CharPrinter
+ const char *NamePtr = "Name";
+
+ // CharArray
+ const char NameArray[] = "Name";
+
+ // WideCharPrinter
+ const wchar_t *WideNamePtr = L"Name";
+
+ // WideCharArray
+ const wchar_t WideNameArray[] = L"Name";
+
+After:
+
+.. code-block:: c++
+
+ // CharPrinter
+ const char *szNamePtr = "Name";
+
+ // CharArray
+ const char szNameArray[] = "Name";
+
+ // WideCharPrinter
+ const wchar_t *wszWideNamePtr = L"Name";
+
+ // WideCharArray
+ const wchar_t wszWideNameArray[] = L"Name";
+
+
+.. option:: HungarianNotation.PrimitiveType.*
+
+ When defined, the check will ensure variable name of involved primitive
+ types will add the prefix with the given string. The default prefixes are
+ defined in the default mapping table.
+
+.. option:: HungarianNotation.UserDefinedType.*
+
+ When defined, the check will ensure variable name of involved primitive
+ types will add the prefix with the given string. The default prefixes are
+ defined in the default mapping table.
+
+
+Before:
+
+.. code-block:: c++
+
+ int8_t ValueI8 = 0;
+ int16_t ValueI16 = 0;
+ int32_t ValueI32 = 0;
+ int64_t ValueI64 = 0;
+ uint8_t ValueU8 = 0;
+ uint16_t ValueU16 = 0;
+ uint32_t ValueU32 = 0;
+ uint64_t ValueU64 = 0;
+ float ValueFloat = 0.0;
+ double ValueDouble = 0.0;
+ ULONG ValueUlong = 0;
+ DWORD ValueDword = 0;
+
+After:
+
+.. code-block:: c++
+
+ int8_t i8ValueI8 = 0;
+ int16_t i16ValueI16 = 0;
+ int32_t i32ValueI32 = 0;
+ int64_t i64ValueI64 = 0;
+ uint8_t u8ValueU8 = 0;
+ uint16_t u16ValueU16 = 0;
+ uint32_t u32ValueU32 = 0;
+ uint64_t u64ValueU64 = 0;
+ float fValueFloat = 0.0;
+ double dValueDouble = 0.0;
+ ULONG ulValueUlong = 0;
+ DWORD dwValueDword = 0;
diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-hungarian-notation-cfgfile.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-hungarian-notation-cfgfile.cpp
new file mode 100644
index 0000000000000..b92349726087f
--- /dev/null
+++ b/clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-hungarian-notation-cfgfile.cpp
@@ -0,0 +1,844 @@
+// RUN: %check_clang_tidy %s readability-identifier-naming %t -- \
+// RUN: -config='{ CheckOptions: [ \
+// RUN: { key: readability-identifier-naming.AbstractClassCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.ClassCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.ClassConstantCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.ClassMemberCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.ConstantCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.ConstantMemberCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.ConstantParameterCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.ConstantPointerParameterCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.ConstexprVariableCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.EnumConstantCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.GlobalConstantCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.GlobalConstantPointerCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.GlobalPointerCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.GlobalVariableCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.LocalConstantCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.LocalConstantPointerCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.LocalPointerCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.LocalVariableCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.MemberCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.ParameterCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.PointerParameterCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.PrivateMemberCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.ProtectedMemberCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.PublicMemberCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.ScopedEnumConstantCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.StaticConstantCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.StaticVariableCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.VariableCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.AbstractClassHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.ClassHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.ClassConstantHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.ClassMemberHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.ConstantHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.ConstantMemberHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.ConstantParameterHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.ConstantPointerParameterHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.ConstexprVariableHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.EnumConstantHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.GlobalConstantHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.GlobalConstantPointerHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.GlobalPointerHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.GlobalVariableHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.LocalConstantHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.LocalConstantPointerHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.LocalPointerHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.LocalVariableHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.MemberHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.ParameterHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.PointerParameterHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.PrivateMemberHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.ProtectedMemberHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.PublicMemberHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.ScopedEnumConstantHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.StaticConstantHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.StaticVariableHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.VariableHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.Options.TreatStructAsClass , value: false }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.DerivedType.Array , value: ary }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.DerivedType.Pointer , value: p }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.DerivedType.FunctionPointer , value: fn }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.CString.CharPrinter , value: sz }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.CString.CharArray , value: sz }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.CString.WideCharPrinter , value: wsz }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.CString.WideCharArray , value: wsz }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.PrimitiveType.int8_t , value: i8 }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.PrimitiveType.int16_t , value: i16 }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.PrimitiveType.int32_t , value: i32 }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.PrimitiveType.int64_t , value: i64 }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.PrimitiveType.uint8_t , value: u8 }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.PrimitiveType.uint16_t , value: u16 }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.PrimitiveType.uint32_t , value: u32 }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.PrimitiveType.uint64_t , value: u64 }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.PrimitiveType.char8_t , value: c8 }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.PrimitiveType.char16_t , value: c16 }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.PrimitiveType.char32_t , value: c32 }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.PrimitiveType.float , value: f }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.PrimitiveType.double , value: d }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.PrimitiveType.char , value: c }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.PrimitiveType.bool , value: b }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.PrimitiveType._Bool , value: b }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.PrimitiveType.int , value: i }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.PrimitiveType.size_t , value: n }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.PrimitiveType.wchar_t , value: wc }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.PrimitiveType.short-int , value: si }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.PrimitiveType.short , value: s }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.PrimitiveType.signed-int , value: si }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.PrimitiveType.signed-short , value: ss }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.PrimitiveType.signed-short-int , value: ssi }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.PrimitiveType.signed-long-long-int , value: slli }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.PrimitiveType.signed-long-long , value: sll }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.PrimitiveType.signed-long-int , value: sli }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.PrimitiveType.signed-long , value: sl }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.PrimitiveType.signed , value: s }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.PrimitiveType.unsigned-long-long-int , value: ulli }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.PrimitiveType.unsigned-long-long , value: ull }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.PrimitiveType.unsigned-long-int , value: uli }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.PrimitiveType.unsigned-long , value: ul }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.PrimitiveType.unsigned-short-int , value: usi }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.PrimitiveType.unsigned-short , value: us }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.PrimitiveType.unsigned-int , value: ui }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.PrimitiveType.unsigned , value: u }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.PrimitiveType.long-long-int , value: lli }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.PrimitiveType.long-double , value: ld }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.PrimitiveType.long-long , value: ll }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.PrimitiveType.long-int , value: li }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.PrimitiveType.long , value: l }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.PrimitiveType.ptr
diff _t , value: p }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.UserDefinedType.BOOL , value: b }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.UserDefinedType.BOOLEAN , value: b }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.UserDefinedType.BYTE , value: by }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.UserDefinedType.CHAR , value: c }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.UserDefinedType.UCHAR , value: uc }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.UserDefinedType.SHORT , value: s }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.UserDefinedType.USHORT , value: us }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.UserDefinedType.WORD , value: w }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.UserDefinedType.DWORD , value: dw }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.UserDefinedType.DWORD32 , value: dw32 }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.UserDefinedType.DWORD64 , value: dw64 }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.UserDefinedType.LONG , value: l }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.UserDefinedType.ULONG , value: ul }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.UserDefinedType.ULONG32 , value: ul32 }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.UserDefinedType.ULONG64 , value: ul64 }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.UserDefinedType.ULONGLONG , value: ull }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.UserDefinedType.HANDLE , value: h }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.UserDefinedType.INT , value: i }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.UserDefinedType.INT8 , value: i8 }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.UserDefinedType.INT16 , value: i16 }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.UserDefinedType.INT32 , value: i32 }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.UserDefinedType.INT64 , value: i64 }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.UserDefinedType.UINT , value: ui }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.UserDefinedType.UINT8 , value: u8 }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.UserDefinedType.UINT16 , value: u16 }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.UserDefinedType.UINT32 , value: u32 }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.UserDefinedType.UINT64 , value: u64 }, \
+// RUN: { key: readability-identifier-naming.HungarianNotation.UserDefinedType.PVOID , value: p }, \
+// RUN: ]}'
+
+// clang-format off
+typedef signed char int8_t; // NOLINT
+typedef short int16_t; // NOLINT
+typedef long int32_t; // NOLINT
+typedef long long int64_t; // NOLINT
+typedef unsigned char uint8_t; // NOLINT
+typedef unsigned short uint16_t; // NOLINT
+typedef unsigned long uint32_t; // NOLINT
+typedef unsigned long long uint64_t; // NOLINT
+#ifndef _WIN32
+typedef unsigned long long size_t; // NOLINT
+#endif
+typedef long intptr_t; // NOLINT
+typedef unsigned long uintptr_t; // NOLINT
+typedef long int ptr
diff _t; // NOLINT
+typedef unsigned char BYTE; // NOLINT
+typedef unsigned short WORD; // NOLINT
+typedef unsigned long DWORD; // NOLINT
+typedef int BOOL; // NOLINT
+typedef int BOOLEAN; // NOLINT
+typedef float FLOAT; // NOLINT
+typedef int INT; // NOLINT
+typedef unsigned int UINT; // NOLINT
+typedef unsigned long ULONG; // NOLINT
+typedef short SHORT; // NOLINT
+typedef unsigned short USHORT; // NOLINT
+typedef char CHAR; // NOLINT
+typedef unsigned char UCHAR; // NOLINT
+typedef signed char INT8; // NOLINT
+typedef signed short INT16; // NOLINT
+typedef signed int INT32; // NOLINT
+typedef signed long long INT64; // NOLINT
+typedef unsigned char UINT8; // NOLINT
+typedef unsigned short UINT16; // NOLINT
+typedef unsigned int UINT32; // NOLINT
+typedef unsigned long long UINT64; // NOLINT
+typedef long LONG; // NOLINT
+typedef signed int LONG32; // NOLINT
+typedef unsigned int ULONG32; // NOLINT
+typedef uint64_t ULONG64; // NOLINT
+typedef unsigned int DWORD32; // NOLINT
+typedef uint64_t DWORD64; // NOLINT
+typedef uint64_t ULONGLONG; // NOLINT
+typedef void* PVOID; // NOLINT
+typedef void* HANDLE; // NOLINT
+typedef void* FILE; // NOLINT
+#define NULL (0) // NOLINT
+// clang-format on
+
+// clang-format off
+//===----------------------------------------------------------------------===//
+// Cases to CheckOptions
+//===----------------------------------------------------------------------===//
+class CMyClass1 {
+public:
+ static int ClassMemberCase;
+ // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: invalid case style for class member 'ClassMemberCase' [readability-identifier-naming]
+ // CHECK-FIXES: {{^}} static int iClassMemberCase;
+
+ char const ConstantMemberCase = 0;
+ // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: invalid case style for constant member 'ConstantMemberCase' [readability-identifier-naming]
+ // CHECK-FIXES: {{^}} char const cConstantMemberCase = 0;
+
+ void MyFunc1(const int ConstantParameterCase);
+ // CHECK-MESSAGES: :[[@LINE-1]]:26: warning: invalid case style for constant parameter 'ConstantParameterCase' [readability-identifier-naming]
+ // CHECK-FIXES: {{^}} void MyFunc1(const int iConstantParameterCase);
+
+ void MyFunc2(const int* ConstantPointerParameterCase);
+ // CHECK-MESSAGES: :[[@LINE-1]]:27: warning: invalid case style for pointer parameter 'ConstantPointerParameterCase' [readability-identifier-naming]
+ // CHECK-FIXES: {{^}} void MyFunc2(const int* piConstantPointerParameterCase);
+
+ static constexpr int ConstexprVariableCase = 123;
+ // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: invalid case style for constexpr variable 'ConstexprVariableCase' [readability-identifier-naming]
+ // CHECK-FIXES: {{^}} static constexpr int iConstexprVariableCase = 123;
+};
+
+const int GlobalConstantCase = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: invalid case style for global constant 'GlobalConstantCase' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}const int iGlobalConstantCase = 0;
+
+const int* GlobalConstantPointerCase = nullptr;
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: invalid case style for global pointer 'GlobalConstantPointerCase' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}const int* piGlobalConstantPointerCase = nullptr;
+
+int* GlobalPointerCase = nullptr;
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global pointer 'GlobalPointerCase' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int* piGlobalPointerCase = nullptr;
+
+int GlobalVariableCase = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'GlobalVariableCase' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int iGlobalVariableCase = 0;
+
+void Func1(){
+ int const LocalConstantCase = 3;
+ // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: invalid case style for local constant 'LocalConstantCase' [readability-identifier-naming]
+ // CHECK-FIXES: {{^}} int const iLocalConstantCase = 3;
+
+ unsigned const ConstantCase = 1;
+ // CHECK-MESSAGES: :[[@LINE-1]]:18: warning: invalid case style for local constant 'ConstantCase' [readability-identifier-naming]
+ // CHECK-FIXES: {{^}} unsigned const uConstantCase = 1;
+
+ int* const LocalConstantPointerCase = nullptr;
+ // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: invalid case style for local constant pointer 'LocalConstantPointerCase' [readability-identifier-naming]
+ // CHECK-FIXES: {{^}} int* const piLocalConstantPointerCase = nullptr;
+
+ int *LocalPointerCase = nullptr;
+ // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for local pointer 'LocalPointerCase' [readability-identifier-naming]
+ // CHECK-FIXES: {{^}} int *piLocalPointerCase = nullptr;
+
+ int LocalVariableCase = 0;
+ // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for local variable 'LocalVariableCase' [readability-identifier-naming]
+ // CHECK-FIXES: {{^}} int iLocalVariableCase = 0;
+}
+
+class CMyClass2 {
+ char MemberCase;
+ // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for private member 'MemberCase' [readability-identifier-naming]
+ // CHECK-FIXES: {{^}} char cMemberCase;
+
+ void Func1(int ParameterCase);
+ // CHECK-MESSAGES: :[[@LINE-1]]:18: warning: invalid case style for parameter 'ParameterCase' [readability-identifier-naming]
+ // CHECK-FIXES: {{^}} void Func1(int iParameterCase);
+
+ void Func2(const int ParameterCase);
+ // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: invalid case style for constant parameter 'ParameterCase' [readability-identifier-naming]
+ // CHECK-FIXES: {{^}} void Func2(const int iParameterCase);
+
+ void Func3(const int *PointerParameterCase);
+ // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: invalid case style for pointer parameter 'PointerParameterCase' [readability-identifier-naming]
+ // CHECK-FIXES: {{^}} void Func3(const int *piPointerParameterCase);
+};
+
+class CMyClass3 {
+private:
+ char PrivateMemberCase;
+ // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for private member 'PrivateMemberCase' [readability-identifier-naming]
+ // CHECK-FIXES: {{^}} char cPrivateMemberCase;
+
+protected:
+ char ProtectedMemberCase;
+ // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for protected member 'ProtectedMemberCase' [readability-identifier-naming]
+ // CHECK-FIXES: {{^}} char cProtectedMemberCase;
+
+public:
+ char PublicMemberCase;
+ // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for public member 'PublicMemberCase' [readability-identifier-naming]
+ // CHECK-FIXES: {{^}} char cPublicMemberCase;
+};
+
+static const int StaticConstantCase = 3;
+// CHECK-MESSAGES: :[[@LINE-1]]:18: warning: invalid case style for global constant 'StaticConstantCase' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}static const int iStaticConstantCase = 3;
+
+static int StaticVariableCase = 3;
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: invalid case style for global variable 'StaticVariableCase' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}static int iStaticVariableCase = 3;
+
+struct MyStruct { int StructCase; };
+// CHECK-MESSAGES: :[[@LINE-1]]:23: warning: invalid case style for public member 'StructCase' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}struct MyStruct { int iStructCase; };
+
+union MyUnion { int UnionCase; long lUnionCase; };
+// CHECK-MESSAGES: :[[@LINE-1]]:21: warning: invalid case style for public member 'UnionCase' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}union MyUnion { int iUnionCase; long lUnionCase; };
+
+//===----------------------------------------------------------------------===//
+// C string
+//===----------------------------------------------------------------------===//
+const char *NamePtr = "Name";
+// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: invalid case style for global pointer 'NamePtr' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}const char *szNamePtr = "Name";
+
+const char NameArray[] = "Name";
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: invalid case style for global constant 'NameArray' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}const char szNameArray[] = "Name";
+
+const char *NamePtrArray[] = {"AA", "BB"};
+// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: invalid case style for global variable 'NamePtrArray' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}const char *pszNamePtrArray[] = {"AA", "BB"};
+
+const wchar_t *WideNamePtr = L"Name";
+// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: invalid case style for global pointer 'WideNamePtr' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}const wchar_t *wszWideNamePtr = L"Name";
+
+const wchar_t WideNameArray[] = L"Name";
+// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: invalid case style for global constant 'WideNameArray' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}const wchar_t wszWideNameArray[] = L"Name";
+
+const wchar_t *WideNamePtrArray[] = {L"AA", L"BB"};
+// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: invalid case style for global variable 'WideNamePtrArray' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}const wchar_t *pwszWideNamePtrArray[] = {L"AA", L"BB"};
+
+class CMyClass4 {
+private:
+ char *Name = "Text";
+ // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for private member 'Name' [readability-identifier-naming]
+ // CHECK-FIXES: {{^}} char *szName = "Text";
+
+ const char *ConstName = "Text";
+ // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: invalid case style for private member 'ConstName' [readability-identifier-naming]
+ // CHECK-FIXES: {{^}} const char *szConstName = "Text";
+
+public:
+ const char* DuplicateString(const char* Input, size_t nRequiredSize);
+ // CHECK-MESSAGES: :[[@LINE-1]]:43: warning: invalid case style for pointer parameter 'Input' [readability-identifier-naming]
+ // CHECK-FIXES: {{^}} const char* DuplicateString(const char* szInput, size_t nRequiredSize);
+
+ size_t UpdateText(const char* Buffer, size_t nBufferSize);
+ // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: invalid case style for pointer parameter 'Buffer' [readability-identifier-naming]
+ // CHECK-FIXES: {{^}} size_t UpdateText(const char* szBuffer, size_t nBufferSize);
+};
+
+
+//===----------------------------------------------------------------------===//
+// Microsoft Windows data types
+//===----------------------------------------------------------------------===//
+DWORD MsDword = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'MsDword' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}DWORD dwMsDword = 0;
+
+BYTE MsByte = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'MsByte' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}BYTE byMsByte = 0;
+
+WORD MsWord = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'MsWord' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}WORD wMsWord = 0;
+
+BOOL MsBool = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'MsBool' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}BOOL bMsBool = 0;
+
+BOOLEAN MsBoolean = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for global variable 'MsBoolean' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}BOOLEAN bMsBoolean = 0;
+
+CHAR MsValueChar = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'MsValueChar' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}CHAR cMsValueChar = 0;
+
+UCHAR MsValueUchar = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'MsValueUchar' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}UCHAR ucMsValueUchar = 0;
+
+SHORT MsValueShort = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'MsValueShort' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}SHORT sMsValueShort = 0;
+
+USHORT MsValueUshort = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for global variable 'MsValueUshort' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}USHORT usMsValueUshort = 0;
+
+WORD MsValueWord = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'MsValueWord' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}WORD wMsValueWord = 0;
+
+DWORD MsValueDword = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'MsValueDword' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}DWORD dwMsValueDword = 0;
+
+DWORD32 MsValueDword32 = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for global variable 'MsValueDword32' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}DWORD32 dw32MsValueDword32 = 0;
+
+DWORD64 MsValueDword64 = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for global variable 'MsValueDword64' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}DWORD64 dw64MsValueDword64 = 0;
+
+LONG MsValueLong = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'MsValueLong' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}LONG lMsValueLong = 0;
+
+ULONG MsValueUlong = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'MsValueUlong' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}ULONG ulMsValueUlong = 0;
+
+ULONG32 MsValueUlong32 = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for global variable 'MsValueUlong32' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}ULONG32 ul32MsValueUlong32 = 0;
+
+ULONG64 MsValueUlong64 = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for global variable 'MsValueUlong64' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}ULONG64 ul64MsValueUlong64 = 0;
+
+ULONGLONG MsValueUlongLong = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: invalid case style for global variable 'MsValueUlongLong' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}ULONGLONG ullMsValueUlongLong = 0;
+
+HANDLE MsValueHandle = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for global pointer 'MsValueHandle' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}HANDLE hMsValueHandle = 0;
+
+INT MsValueInt = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'MsValueInt' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}INT iMsValueInt = 0;
+
+INT8 MsValueInt8 = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'MsValueInt8' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}INT8 i8MsValueInt8 = 0;
+
+INT16 MsValueInt16 = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'MsValueInt16' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}INT16 i16MsValueInt16 = 0;
+
+INT32 MsValueInt32 = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'MsValueInt32' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}INT32 i32MsValueInt32 = 0;
+
+INT64 MsValueINt64 = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'MsValueINt64' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}INT64 i64MsValueINt64 = 0;
+
+UINT MsValueUint = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'MsValueUint' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}UINT uiMsValueUint = 0;
+
+UINT8 MsValueUint8 = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'MsValueUint8' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}UINT8 u8MsValueUint8 = 0;
+
+UINT16 MsValueUint16 = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for global variable 'MsValueUint16' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}UINT16 u16MsValueUint16 = 0;
+
+UINT32 MsValueUint32 = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for global variable 'MsValueUint32' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}UINT32 u32MsValueUint32 = 0;
+
+UINT64 MsValueUint64 = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for global variable 'MsValueUint64' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}UINT64 u64MsValueUint64 = 0;
+
+PVOID MsValuePvoid = NULL;
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global pointer 'MsValuePvoid' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}PVOID pMsValuePvoid = NULL;
+
+
+//===----------------------------------------------------------------------===//
+// Array
+//===----------------------------------------------------------------------===//
+unsigned GlobalUnsignedArray[] = {1, 2, 3};
+// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: invalid case style for global variable 'GlobalUnsignedArray' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}unsigned aryGlobalUnsignedArray[] = {1, 2, 3};
+
+int GlobalIntArray[] = {1, 2, 3};
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'GlobalIntArray' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int aryGlobalIntArray[] = {1, 2, 3};
+
+int DataInt[1] = {0};
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'DataInt' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int aryDataInt[1] = {0};
+
+int DataArray[2] = {0};
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'DataArray' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int aryDataArray[2] = {0};
+
+
+//===----------------------------------------------------------------------===//
+// Pointer
+//===----------------------------------------------------------------------===//
+int *DataIntPtr[1] = {0};
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'DataIntPtr' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int *paryDataIntPtr[1] = {0};
+
+void *BufferPtr1;
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global pointer 'BufferPtr1' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}void *pBufferPtr1;
+
+void **BufferPtr2;
+// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for global pointer 'BufferPtr2' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}void **ppBufferPtr2;
+
+void **pBufferPtr3;
+// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for global pointer 'pBufferPtr3' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}void **ppBufferPtr3;
+
+int *pBufferPtr4;
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global pointer 'pBufferPtr4' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int *piBufferPtr4;
+
+typedef void (*FUNC_PTR_HELLO)();
+FUNC_PTR_HELLO Hello = NULL;
+// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: invalid case style for global pointer 'Hello' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}FUNC_PTR_HELLO fnHello = NULL;
+
+void *ValueVoidPtr = NULL;
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global pointer 'ValueVoidPtr' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}void *pValueVoidPtr = NULL;
+
+ptr
diff _t PtrDiff = NULL;
+// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: invalid case style for global variable 'PtrDiff' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}ptr
diff _t pPtrDiff = NULL;
+
+int8_t *ValueI8Ptr;
+// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for global pointer 'ValueI8Ptr' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int8_t *pi8ValueI8Ptr;
+
+uint8_t *ValueU8Ptr;
+// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: invalid case style for global pointer 'ValueU8Ptr' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}uint8_t *pu8ValueU8Ptr;
+
+void MyFunc2(void* Val){}
+// CHECK-MESSAGES: :[[@LINE-1]]:20: warning: invalid case style for pointer parameter 'Val' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}void MyFunc2(void* pVal){}
+
+
+//===----------------------------------------------------------------------===//
+// Reference
+//===----------------------------------------------------------------------===//
+int iValueIndex = 1;
+int &RefValueIndex = iValueIndex;
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'RefValueIndex' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int &iRefValueIndex = iValueIndex;
+
+const int &ConstRefValue = iValueIndex;
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: invalid case style for global variable 'ConstRefValue' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}const int &iConstRefValue = iValueIndex;
+
+long long llValueLongLong = 2;
+long long &RefValueLongLong = llValueLongLong;
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: invalid case style for global variable 'RefValueLongLong' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}long long &llRefValueLongLong = llValueLongLong;
+
+
+//===----------------------------------------------------------------------===//
+// Various types
+//===----------------------------------------------------------------------===//
+int8_t ValueI8;
+// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for global variable 'ValueI8' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int8_t i8ValueI8;
+
+int16_t ValueI16 = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for global 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 global 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 global 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 global 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 global 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 global 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 global variable 'ValueU64' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}uint64_t u64ValueU64 = 0;
+
+float ValueFloat = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'ValueFloat' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}float fValueFloat = 0;
+
+double ValueDouble = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for global variable 'ValueDouble' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}double dValueDouble = 0;
+
+char ValueChar = 'c';
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'ValueChar' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}char cValueChar = 'c';
+
+bool ValueBool = true;
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'ValueBool' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}bool bValueBool = true;
+
+int ValueInt = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'ValueInt' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int iValueInt = 0;
+
+size_t ValueSize = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for global 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 global variable 'ValueWchar' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}wchar_t wcValueWchar = 'w';
+
+short ValueShort = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'ValueShort' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}short sValueShort = 0;
+
+unsigned ValueUnsigned = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: invalid case style for global variable 'ValueUnsigned' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}unsigned uValueUnsigned = 0;
+
+signed ValueSigned = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for global variable 'ValueSigned' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}signed sValueSigned = 0;
+
+long ValueLong = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'ValueLong' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}long lValueLong = 0;
+
+long long ValueLongLong = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: invalid case style for global variable 'ValueLongLong' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}long long llValueLongLong = 0;
+
+long long int ValueLongLongInt = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: invalid case style for global variable 'ValueLongLongInt' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}long long int lliValueLongLongInt = 0;
+
+long double ValueLongDouble = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: invalid case style for global variable 'ValueLongDouble' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}long double ldValueLongDouble = 0;
+
+signed int ValueSignedInt = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: invalid case style for global variable 'ValueSignedInt' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}signed int siValueSignedInt = 0;
+
+signed short ValueSignedShort = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:14: warning: invalid case style for global variable 'ValueSignedShort' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}signed short ssValueSignedShort = 0;
+
+signed short int ValueSignedShortInt = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:18: warning: invalid case style for global variable 'ValueSignedShortInt' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}signed short int ssiValueSignedShortInt = 0;
+
+signed long long ValueSignedLongLong = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:18: warning: invalid case style for global variable 'ValueSignedLongLong' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}signed long long sllValueSignedLongLong = 0;
+
+signed long int ValueSignedLongInt = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:17: warning: invalid case style for global variable 'ValueSignedLongInt' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}signed long int sliValueSignedLongInt = 0;
+
+signed long ValueSignedLong = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: invalid case style for global variable 'ValueSignedLong' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}signed long slValueSignedLong = 0;
+
+unsigned long long int ValueUnsignedLongLongInt = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:24: warning: invalid case style for global variable 'ValueUnsignedLongLongInt' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}unsigned long long int ulliValueUnsignedLongLongInt = 0;
+
+unsigned long long ValueUnsignedLongLong = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:20: warning: invalid case style for global variable 'ValueUnsignedLongLong' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}unsigned long long ullValueUnsignedLongLong = 0;
+
+unsigned long int ValueUnsignedLongInt = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: invalid case style for global variable 'ValueUnsignedLongInt' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}unsigned long int uliValueUnsignedLongInt = 0;
+
+unsigned long ValueUnsignedLong = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: invalid case style for global variable 'ValueUnsignedLong' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}unsigned long ulValueUnsignedLong = 0;
+
+unsigned short int ValueUnsignedShortInt = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:20: warning: invalid case style for global variable 'ValueUnsignedShortInt' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}unsigned short int usiValueUnsignedShortInt = 0;
+
+unsigned short ValueUnsignedShort = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: invalid case style for global variable 'ValueUnsignedShort' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}unsigned short usValueUnsignedShort = 0;
+
+unsigned int ValueUnsignedInt = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:14: warning: invalid case style for global variable 'ValueUnsignedInt' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}unsigned int uiValueUnsignedInt = 0;
+
+long int ValueLongInt = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: invalid case style for global variable 'ValueLongInt' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}long int liValueLongInt = 0;
+
+
+//===----------------------------------------------------------------------===//
+// Specifier, Qualifier, Other keywords
+//===----------------------------------------------------------------------===//
+volatile int VolatileInt = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:14: warning: invalid case style for global variable 'VolatileInt' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}volatile int iVolatileInt = 0;
+
+thread_local int ThreadLocalValueInt = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:18: warning: invalid case style for global variable 'ThreadLocalValueInt' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}thread_local int iThreadLocalValueInt = 0;
+
+extern int ExternValueInt;
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: invalid case style for global variable 'ExternValueInt' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}extern int iExternValueInt;
+
+struct DataBuffer {
+ mutable size_t Size;
+};
+// CHECK-MESSAGES: :[[@LINE-2]]:20: warning: invalid case style for public member 'Size' [readability-identifier-naming]
+// CHECK-FIXES: {{^}} mutable size_t nSize;
+
+static constexpr int const &ConstExprInt = 42;
+// CHECK-MESSAGES: :[[@LINE-1]]:29: warning: invalid case style for constexpr variable 'ConstExprInt' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}static constexpr int const &iConstExprInt = 42;
+
+
+//===----------------------------------------------------------------------===//
+// Redefined types
+//===----------------------------------------------------------------------===//
+typedef int INDEX;
+INDEX iIndex = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'iIndex' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}INDEX Index = 0;
+
+
+//===----------------------------------------------------------------------===//
+// Class
+//===----------------------------------------------------------------------===//
+class ClassCase { int Func(); };
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for class 'ClassCase' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}class CClassCase { int Func(); };
+
+class AbstractClassCase { virtual int Func() = 0; };
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for abstract class 'AbstractClassCase' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}class IAbstractClassCase { virtual int Func() = 0; };
+
+class AbstractClassCase1 { virtual int Func1() = 0; int Func2(); };
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for abstract class 'AbstractClassCase1' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}class IAbstractClassCase1 { virtual int Func1() = 0; int Func2(); };
+
+class ClassConstantCase { public: static const int iConstantCase; };
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for class 'ClassConstantCase' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}class CClassConstantCase { public: static const int iConstantCase; };
+
+//===----------------------------------------------------------------------===//
+// Other Cases
+//===----------------------------------------------------------------------===//
+int lower_case = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'lower_case' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int iLowerCase = 0;
+
+int lower_case1 = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'lower_case1' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int iLowerCase1 = 0;
+
+int lower_case_2 = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'lower_case_2' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int iLowerCase2 = 0;
+
+int UPPER_CASE = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'UPPER_CASE' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int iUpperCase = 0;
+
+int UPPER_CASE_1 = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'UPPER_CASE_1' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int iUpperCase1 = 0;
+
+int camelBack = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'camelBack' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int iCamelBack = 0;
+
+int camelBack_1 = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'camelBack_1' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int iCamelBack1 = 0;
+
+int camelBack2 = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'camelBack2' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int iCamelBack2 = 0;
+
+int CamelCase = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'CamelCase' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int iCamelCase = 0;
+
+int CamelCase_1 = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'CamelCase_1' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int iCamelCase1 = 0;
+
+int CamelCase2 = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'CamelCase2' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int iCamelCase2 = 0;
+
+int camel_Snake_Back = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'camel_Snake_Back' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int iCamelSnakeBack = 0;
+
+int camel_Snake_Back_1 = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'camel_Snake_Back_1' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int iCamelSnakeBack1 = 0;
+
+int Camel_Snake_Case = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'Camel_Snake_Case' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int iCamelSnakeCase = 0;
+
+int Camel_Snake_Case_1 = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'Camel_Snake_Case_1' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int iCamelSnakeCase1 = 0;
+
+//===----------------------------------------------------------------------===//
+// Enum
+//===----------------------------------------------------------------------===//
+enum REV_TYPE { RevValid };
+// CHECK-MESSAGES: :[[@LINE-1]]:17: warning: invalid case style for enum constant 'RevValid' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}enum REV_TYPE { rtRevValid };
+
+enum EnumConstantCase { OneByte, TwoByte };
+// CHECK-MESSAGES: :[[@LINE-1]]:25: warning: invalid case style for enum constant 'OneByte' [readability-identifier-naming]
+// CHECK-MESSAGES: :[[@LINE-2]]:34: warning: invalid case style for enum constant 'TwoByte' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}enum EnumConstantCase { eccOneByte, eccTwoByte };
+
+enum class ScopedEnumConstantCase { Case1 };
+// CHECK-MESSAGES: :[[@LINE-1]]:37: warning: invalid case style for scoped enum constant 'Case1' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}enum class ScopedEnumConstantCase { seccCase1 };
+// clang-format on
diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-hungarian-notation.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-hungarian-notation.cpp
new file mode 100644
index 0000000000000..98bd406f89f8a
--- /dev/null
+++ b/clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-hungarian-notation.cpp
@@ -0,0 +1,765 @@
+// RUN: %check_clang_tidy %s readability-identifier-naming %t -- \
+// RUN: -config='{ CheckOptions: [ \
+// RUN: { key: readability-identifier-naming.AbstractClassCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.ClassCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.ClassConstantCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.ClassMemberCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.ConstantCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.ConstantMemberCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.ConstantParameterCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.ConstantPointerParameterCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.ConstexprVariableCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.EnumConstantCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.GlobalConstantCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.GlobalConstantPointerCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.GlobalPointerCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.GlobalVariableCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.LocalConstantCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.LocalConstantPointerCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.LocalPointerCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.LocalVariableCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.MemberCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.ParameterCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.PointerParameterCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.PrivateMemberCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.ProtectedMemberCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.PublicMemberCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.ScopedEnumConstantCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.StaticConstantCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.StaticVariableCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.VariableCase , value: CamelCase }, \
+// RUN: { key: readability-identifier-naming.AbstractClassHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.ClassHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.ClassConstantHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.ClassMemberHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.ConstantHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.ConstantMemberHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.ConstantParameterHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.ConstantPointerParameterHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.ConstexprVariableHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.EnumConstantHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.GlobalConstantHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.GlobalConstantPointerHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.GlobalPointerHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.GlobalVariableHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.LocalConstantHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.LocalConstantPointerHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.LocalPointerHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.LocalVariableHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.MemberHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.ParameterHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.PointerParameterHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.PrivateMemberHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.ProtectedMemberHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.PublicMemberHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.ScopedEnumConstantHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.StaticConstantHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.StaticVariableHungarianPrefix , value: On }, \
+// RUN: { key: readability-identifier-naming.VariableHungarianPrefix , value: On }, \
+// RUN: ]}'
+
+// clang-format off
+typedef signed char int8_t; // NOLINT
+typedef short int16_t; // NOLINT
+typedef long int32_t; // NOLINT
+typedef long long int64_t; // NOLINT
+typedef unsigned char uint8_t; // NOLINT
+typedef unsigned short uint16_t; // NOLINT
+typedef unsigned long uint32_t; // NOLINT
+typedef unsigned long long uint64_t; // NOLINT
+#ifndef _WIN32
+typedef unsigned long long size_t; // NOLINT
+#endif
+typedef long intptr_t; // NOLINT
+typedef unsigned long uintptr_t; // NOLINT
+typedef long int ptr
diff _t; // NOLINT
+typedef unsigned char BYTE; // NOLINT
+typedef unsigned short WORD; // NOLINT
+typedef unsigned long DWORD; // NOLINT
+typedef int BOOL; // NOLINT
+typedef int BOOLEAN; // NOLINT
+typedef float FLOAT; // NOLINT
+typedef int INT; // NOLINT
+typedef unsigned int UINT; // NOLINT
+typedef unsigned long ULONG; // NOLINT
+typedef short SHORT; // NOLINT
+typedef unsigned short USHORT; // NOLINT
+typedef char CHAR; // NOLINT
+typedef unsigned char UCHAR; // NOLINT
+typedef signed char INT8; // NOLINT
+typedef signed short INT16; // NOLINT
+typedef signed int INT32; // NOLINT
+typedef signed long long INT64; // NOLINT
+typedef unsigned char UINT8; // NOLINT
+typedef unsigned short UINT16; // NOLINT
+typedef unsigned int UINT32; // NOLINT
+typedef unsigned long long UINT64; // NOLINT
+typedef long LONG; // NOLINT
+typedef signed int LONG32; // NOLINT
+typedef unsigned int ULONG32; // NOLINT
+typedef uint64_t ULONG64; // NOLINT
+typedef unsigned int DWORD32; // NOLINT
+typedef uint64_t DWORD64; // NOLINT
+typedef uint64_t ULONGLONG; // NOLINT
+typedef void* PVOID; // NOLINT
+typedef void* HANDLE; // NOLINT
+typedef void* FILE; // NOLINT
+#define NULL (0) // NOLINT
+// clang-format on
+
+// clang-format off
+//===----------------------------------------------------------------------===//
+// Cases to CheckOptions
+//===----------------------------------------------------------------------===//
+class CMyClass1 {
+public:
+ static int ClassMemberCase;
+ // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: invalid case style for class member 'ClassMemberCase' [readability-identifier-naming]
+ // CHECK-FIXES: {{^}} static int iClassMemberCase;
+
+ char const ConstantMemberCase = 0;
+ // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: invalid case style for constant member 'ConstantMemberCase' [readability-identifier-naming]
+ // CHECK-FIXES: {{^}} char const cConstantMemberCase = 0;
+
+ void MyFunc1(const int ConstantParameterCase);
+ // CHECK-MESSAGES: :[[@LINE-1]]:26: warning: invalid case style for constant parameter 'ConstantParameterCase' [readability-identifier-naming]
+ // CHECK-FIXES: {{^}} void MyFunc1(const int iConstantParameterCase);
+
+ void MyFunc2(const int* ConstantPointerParameterCase);
+ // CHECK-MESSAGES: :[[@LINE-1]]:27: warning: invalid case style for pointer parameter 'ConstantPointerParameterCase' [readability-identifier-naming]
+ // CHECK-FIXES: {{^}} void MyFunc2(const int* piConstantPointerParameterCase);
+
+ static constexpr int ConstexprVariableCase = 123;
+ // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: invalid case style for constexpr variable 'ConstexprVariableCase' [readability-identifier-naming]
+ // CHECK-FIXES: {{^}} static constexpr int iConstexprVariableCase = 123;
+};
+
+const int GlobalConstantCase = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: invalid case style for global constant 'GlobalConstantCase' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}const int iGlobalConstantCase = 0;
+
+const int* GlobalConstantPointerCase = nullptr;
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: invalid case style for global pointer 'GlobalConstantPointerCase' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}const int* piGlobalConstantPointerCase = nullptr;
+
+int* GlobalPointerCase = nullptr;
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global pointer 'GlobalPointerCase' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int* piGlobalPointerCase = nullptr;
+
+int GlobalVariableCase = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'GlobalVariableCase' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int iGlobalVariableCase = 0;
+
+void Func1(){
+ int const LocalConstantCase = 3;
+ // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: invalid case style for local constant 'LocalConstantCase' [readability-identifier-naming]
+ // CHECK-FIXES: {{^}} int const iLocalConstantCase = 3;
+
+ unsigned const ConstantCase = 1;
+ // CHECK-MESSAGES: :[[@LINE-1]]:18: warning: invalid case style for local constant 'ConstantCase' [readability-identifier-naming]
+ // CHECK-FIXES: {{^}} unsigned const uConstantCase = 1;
+
+ int* const LocalConstantPointerCase = nullptr;
+ // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: invalid case style for local constant pointer 'LocalConstantPointerCase' [readability-identifier-naming]
+ // CHECK-FIXES: {{^}} int* const piLocalConstantPointerCase = nullptr;
+
+ int *LocalPointerCase = nullptr;
+ // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for local pointer 'LocalPointerCase' [readability-identifier-naming]
+ // CHECK-FIXES: {{^}} int *piLocalPointerCase = nullptr;
+
+ int LocalVariableCase = 0;
+ // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for local variable 'LocalVariableCase' [readability-identifier-naming]
+ // CHECK-FIXES: {{^}} int iLocalVariableCase = 0;
+}
+
+class CMyClass2 {
+ char MemberCase;
+ // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for private member 'MemberCase' [readability-identifier-naming]
+ // CHECK-FIXES: {{^}} char cMemberCase;
+
+ void Func1(int ParameterCase);
+ // CHECK-MESSAGES: :[[@LINE-1]]:18: warning: invalid case style for parameter 'ParameterCase' [readability-identifier-naming]
+ // CHECK-FIXES: {{^}} void Func1(int iParameterCase);
+
+ void Func2(const int ParameterCase);
+ // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: invalid case style for constant parameter 'ParameterCase' [readability-identifier-naming]
+ // CHECK-FIXES: {{^}} void Func2(const int iParameterCase);
+
+ void Func3(const int *PointerParameterCase);
+ // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: invalid case style for pointer parameter 'PointerParameterCase' [readability-identifier-naming]
+ // CHECK-FIXES: {{^}} void Func3(const int *piPointerParameterCase);
+};
+
+class CMyClass3 {
+private:
+ char PrivateMemberCase;
+ // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for private member 'PrivateMemberCase' [readability-identifier-naming]
+ // CHECK-FIXES: {{^}} char cPrivateMemberCase;
+
+protected:
+ char ProtectedMemberCase;
+ // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for protected member 'ProtectedMemberCase' [readability-identifier-naming]
+ // CHECK-FIXES: {{^}} char cProtectedMemberCase;
+
+public:
+ char PublicMemberCase;
+ // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for public member 'PublicMemberCase' [readability-identifier-naming]
+ // CHECK-FIXES: {{^}} char cPublicMemberCase;
+};
+
+static const int StaticConstantCase = 3;
+// CHECK-MESSAGES: :[[@LINE-1]]:18: warning: invalid case style for global constant 'StaticConstantCase' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}static const int iStaticConstantCase = 3;
+
+static int StaticVariableCase = 3;
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: invalid case style for global variable 'StaticVariableCase' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}static int iStaticVariableCase = 3;
+
+struct MyStruct { int StructCase; };
+// CHECK-MESSAGES: :[[@LINE-1]]:23: warning: invalid case style for public member 'StructCase' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}struct MyStruct { int iStructCase; };
+
+union MyUnion { int UnionCase; long lUnionCase; };
+// CHECK-MESSAGES: :[[@LINE-1]]:21: warning: invalid case style for public member 'UnionCase' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}union MyUnion { int iUnionCase; long lUnionCase; };
+
+//===----------------------------------------------------------------------===//
+// C string
+//===----------------------------------------------------------------------===//
+const char *NamePtr = "Name";
+// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: invalid case style for global pointer 'NamePtr' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}const char *szNamePtr = "Name";
+
+const char NameArray[] = "Name";
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: invalid case style for global constant 'NameArray' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}const char szNameArray[] = "Name";
+
+const char *NamePtrArray[] = {"AA", "BB"};
+// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: invalid case style for global variable 'NamePtrArray' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}const char *pszNamePtrArray[] = {"AA", "BB"};
+
+const wchar_t *WideNamePtr = L"Name";
+// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: invalid case style for global pointer 'WideNamePtr' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}const wchar_t *wszWideNamePtr = L"Name";
+
+const wchar_t WideNameArray[] = L"Name";
+// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: invalid case style for global constant 'WideNameArray' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}const wchar_t wszWideNameArray[] = L"Name";
+
+const wchar_t *WideNamePtrArray[] = {L"AA", L"BB"};
+// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: invalid case style for global variable 'WideNamePtrArray' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}const wchar_t *pwszWideNamePtrArray[] = {L"AA", L"BB"};
+
+class CMyClass4 {
+private:
+ char *Name = "Text";
+ // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for private member 'Name' [readability-identifier-naming]
+ // CHECK-FIXES: {{^}} char *szName = "Text";
+
+ const char *ConstName = "Text";
+ // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: invalid case style for private member 'ConstName' [readability-identifier-naming]
+ // CHECK-FIXES: {{^}} const char *szConstName = "Text";
+
+public:
+ const char* DuplicateString(const char* Input, size_t nRequiredSize);
+ // CHECK-MESSAGES: :[[@LINE-1]]:43: warning: invalid case style for pointer parameter 'Input' [readability-identifier-naming]
+ // CHECK-FIXES: {{^}} const char* DuplicateString(const char* szInput, size_t nRequiredSize);
+
+ size_t UpdateText(const char* Buffer, size_t nBufferSize);
+ // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: invalid case style for pointer parameter 'Buffer' [readability-identifier-naming]
+ // CHECK-FIXES: {{^}} size_t UpdateText(const char* szBuffer, size_t nBufferSize);
+};
+
+
+//===----------------------------------------------------------------------===//
+// Microsoft Windows data types
+//===----------------------------------------------------------------------===//
+DWORD MsDword = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'MsDword' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}DWORD dwMsDword = 0;
+
+BYTE MsByte = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'MsByte' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}BYTE byMsByte = 0;
+
+WORD MsWord = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'MsWord' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}WORD wMsWord = 0;
+
+BOOL MsBool = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'MsBool' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}BOOL bMsBool = 0;
+
+BOOLEAN MsBoolean = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for global variable 'MsBoolean' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}BOOLEAN bMsBoolean = 0;
+
+CHAR MsValueChar = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'MsValueChar' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}CHAR cMsValueChar = 0;
+
+UCHAR MsValueUchar = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'MsValueUchar' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}UCHAR ucMsValueUchar = 0;
+
+SHORT MsValueShort = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'MsValueShort' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}SHORT sMsValueShort = 0;
+
+USHORT MsValueUshort = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for global variable 'MsValueUshort' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}USHORT usMsValueUshort = 0;
+
+WORD MsValueWord = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'MsValueWord' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}WORD wMsValueWord = 0;
+
+DWORD MsValueDword = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'MsValueDword' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}DWORD dwMsValueDword = 0;
+
+DWORD32 MsValueDword32 = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for global variable 'MsValueDword32' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}DWORD32 dw32MsValueDword32 = 0;
+
+DWORD64 MsValueDword64 = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for global variable 'MsValueDword64' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}DWORD64 dw64MsValueDword64 = 0;
+
+LONG MsValueLong = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'MsValueLong' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}LONG lMsValueLong = 0;
+
+ULONG MsValueUlong = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'MsValueUlong' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}ULONG ulMsValueUlong = 0;
+
+ULONG32 MsValueUlong32 = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for global variable 'MsValueUlong32' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}ULONG32 ul32MsValueUlong32 = 0;
+
+ULONG64 MsValueUlong64 = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for global variable 'MsValueUlong64' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}ULONG64 ul64MsValueUlong64 = 0;
+
+ULONGLONG MsValueUlongLong = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: invalid case style for global variable 'MsValueUlongLong' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}ULONGLONG ullMsValueUlongLong = 0;
+
+HANDLE MsValueHandle = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for global pointer 'MsValueHandle' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}HANDLE hMsValueHandle = 0;
+
+INT MsValueInt = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'MsValueInt' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}INT iMsValueInt = 0;
+
+INT8 MsValueInt8 = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'MsValueInt8' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}INT8 i8MsValueInt8 = 0;
+
+INT16 MsValueInt16 = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'MsValueInt16' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}INT16 i16MsValueInt16 = 0;
+
+INT32 MsValueInt32 = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'MsValueInt32' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}INT32 i32MsValueInt32 = 0;
+
+INT64 MsValueINt64 = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'MsValueINt64' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}INT64 i64MsValueINt64 = 0;
+
+UINT MsValueUint = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'MsValueUint' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}UINT uiMsValueUint = 0;
+
+UINT8 MsValueUint8 = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'MsValueUint8' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}UINT8 u8MsValueUint8 = 0;
+
+UINT16 MsValueUint16 = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for global variable 'MsValueUint16' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}UINT16 u16MsValueUint16 = 0;
+
+UINT32 MsValueUint32 = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for global variable 'MsValueUint32' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}UINT32 u32MsValueUint32 = 0;
+
+UINT64 MsValueUint64 = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for global variable 'MsValueUint64' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}UINT64 u64MsValueUint64 = 0;
+
+PVOID MsValuePvoid = NULL;
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global pointer 'MsValuePvoid' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}PVOID pMsValuePvoid = NULL;
+
+
+//===----------------------------------------------------------------------===//
+// Array
+//===----------------------------------------------------------------------===//
+unsigned GlobalUnsignedArray[] = {1, 2, 3};
+// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: invalid case style for global variable 'GlobalUnsignedArray' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}unsigned aGlobalUnsignedArray[] = {1, 2, 3};
+
+int GlobalIntArray[] = {1, 2, 3};
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'GlobalIntArray' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int aGlobalIntArray[] = {1, 2, 3};
+
+int DataInt[1] = {0};
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'DataInt' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int aDataInt[1] = {0};
+
+int DataArray[2] = {0};
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'DataArray' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int aDataArray[2] = {0};
+
+
+//===----------------------------------------------------------------------===//
+// Pointer
+//===----------------------------------------------------------------------===//
+int *DataIntPtr[1] = {0};
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'DataIntPtr' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int *paDataIntPtr[1] = {0};
+
+void *BufferPtr1;
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global pointer 'BufferPtr1' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}void *pBufferPtr1;
+
+void **BufferPtr2;
+// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for global pointer 'BufferPtr2' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}void **ppBufferPtr2;
+
+void **pBufferPtr3;
+// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for global pointer 'pBufferPtr3' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}void **ppBufferPtr3;
+
+int *pBufferPtr4;
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global pointer 'pBufferPtr4' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int *piBufferPtr4;
+
+typedef void (*FUNC_PTR_HELLO)();
+FUNC_PTR_HELLO Hello = NULL;
+// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: invalid case style for global pointer 'Hello' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}FUNC_PTR_HELLO fnHello = NULL;
+
+void *ValueVoidPtr = NULL;
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global pointer 'ValueVoidPtr' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}void *pValueVoidPtr = NULL;
+
+ptr
diff _t PtrDiff = NULL;
+// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: invalid case style for global variable 'PtrDiff' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}ptr
diff _t pPtrDiff = NULL;
+
+int8_t *ValueI8Ptr;
+// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for global pointer 'ValueI8Ptr' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int8_t *pi8ValueI8Ptr;
+
+uint8_t *ValueU8Ptr;
+// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: invalid case style for global pointer 'ValueU8Ptr' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}uint8_t *pu8ValueU8Ptr;
+
+void MyFunc2(void* Val){}
+// CHECK-MESSAGES: :[[@LINE-1]]:20: warning: invalid case style for pointer parameter 'Val' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}void MyFunc2(void* pVal){}
+
+
+//===----------------------------------------------------------------------===//
+// Reference
+//===----------------------------------------------------------------------===//
+int iValueIndex = 1;
+int &RefValueIndex = iValueIndex;
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'RefValueIndex' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int &iRefValueIndex = iValueIndex;
+
+const int &ConstRefValue = iValueIndex;
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: invalid case style for global variable 'ConstRefValue' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}const int &iConstRefValue = iValueIndex;
+
+long long llValueLongLong = 2;
+long long &RefValueLongLong = llValueLongLong;
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: invalid case style for global variable 'RefValueLongLong' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}long long &llRefValueLongLong = llValueLongLong;
+
+
+//===----------------------------------------------------------------------===//
+// Various types
+//===----------------------------------------------------------------------===//
+int8_t ValueI8;
+// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for global variable 'ValueI8' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int8_t i8ValueI8;
+
+int16_t ValueI16 = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for global 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 global 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 global 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 global 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 global 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 global 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 global variable 'ValueU64' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}uint64_t u64ValueU64 = 0;
+
+float ValueFloat = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'ValueFloat' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}float fValueFloat = 0;
+
+double ValueDouble = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for global variable 'ValueDouble' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}double dValueDouble = 0;
+
+char ValueChar = 'c';
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'ValueChar' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}char cValueChar = 'c';
+
+bool ValueBool = true;
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'ValueBool' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}bool bValueBool = true;
+
+int ValueInt = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'ValueInt' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int iValueInt = 0;
+
+size_t ValueSize = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for global 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 global variable 'ValueWchar' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}wchar_t wcValueWchar = 'w';
+
+short ValueShort = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'ValueShort' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}short sValueShort = 0;
+
+unsigned ValueUnsigned = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: invalid case style for global variable 'ValueUnsigned' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}unsigned uValueUnsigned = 0;
+
+signed ValueSigned = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for global variable 'ValueSigned' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}signed sValueSigned = 0;
+
+long ValueLong = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global variable 'ValueLong' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}long lValueLong = 0;
+
+long long ValueLongLong = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: invalid case style for global variable 'ValueLongLong' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}long long llValueLongLong = 0;
+
+long long int ValueLongLongInt = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: invalid case style for global variable 'ValueLongLongInt' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}long long int lliValueLongLongInt = 0;
+
+long double ValueLongDouble = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: invalid case style for global variable 'ValueLongDouble' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}long double ldValueLongDouble = 0;
+
+signed int ValueSignedInt = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: invalid case style for global variable 'ValueSignedInt' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}signed int siValueSignedInt = 0;
+
+signed short ValueSignedShort = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:14: warning: invalid case style for global variable 'ValueSignedShort' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}signed short ssValueSignedShort = 0;
+
+signed short int ValueSignedShortInt = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:18: warning: invalid case style for global variable 'ValueSignedShortInt' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}signed short int ssiValueSignedShortInt = 0;
+
+signed long long ValueSignedLongLong = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:18: warning: invalid case style for global variable 'ValueSignedLongLong' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}signed long long sllValueSignedLongLong = 0;
+
+signed long int ValueSignedLongInt = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:17: warning: invalid case style for global variable 'ValueSignedLongInt' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}signed long int sliValueSignedLongInt = 0;
+
+signed long ValueSignedLong = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: invalid case style for global variable 'ValueSignedLong' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}signed long slValueSignedLong = 0;
+
+unsigned long long int ValueUnsignedLongLongInt = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:24: warning: invalid case style for global variable 'ValueUnsignedLongLongInt' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}unsigned long long int ulliValueUnsignedLongLongInt = 0;
+
+unsigned long long ValueUnsignedLongLong = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:20: warning: invalid case style for global variable 'ValueUnsignedLongLong' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}unsigned long long ullValueUnsignedLongLong = 0;
+
+unsigned long int ValueUnsignedLongInt = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: invalid case style for global variable 'ValueUnsignedLongInt' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}unsigned long int uliValueUnsignedLongInt = 0;
+
+unsigned long ValueUnsignedLong = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: invalid case style for global variable 'ValueUnsignedLong' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}unsigned long ulValueUnsignedLong = 0;
+
+unsigned short int ValueUnsignedShortInt = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:20: warning: invalid case style for global variable 'ValueUnsignedShortInt' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}unsigned short int usiValueUnsignedShortInt = 0;
+
+unsigned short ValueUnsignedShort = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: invalid case style for global variable 'ValueUnsignedShort' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}unsigned short usValueUnsignedShort = 0;
+
+unsigned int ValueUnsignedInt = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:14: warning: invalid case style for global variable 'ValueUnsignedInt' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}unsigned int uiValueUnsignedInt = 0;
+
+long int ValueLongInt = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: invalid case style for global variable 'ValueLongInt' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}long int liValueLongInt = 0;
+
+
+//===----------------------------------------------------------------------===//
+// Specifier, Qualifier, Other keywords
+//===----------------------------------------------------------------------===//
+volatile int VolatileInt = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:14: warning: invalid case style for global variable 'VolatileInt' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}volatile int iVolatileInt = 0;
+
+thread_local int ThreadLocalValueInt = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:18: warning: invalid case style for global variable 'ThreadLocalValueInt' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}thread_local int iThreadLocalValueInt = 0;
+
+extern int ExternValueInt;
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: invalid case style for global variable 'ExternValueInt' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}extern int iExternValueInt;
+
+struct DataBuffer {
+ mutable size_t Size;
+};
+// CHECK-MESSAGES: :[[@LINE-2]]:20: warning: invalid case style for public member 'Size' [readability-identifier-naming]
+// CHECK-FIXES: {{^}} mutable size_t nSize;
+
+static constexpr int const &ConstExprInt = 42;
+// CHECK-MESSAGES: :[[@LINE-1]]:29: warning: invalid case style for constexpr variable 'ConstExprInt' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}static constexpr int const &iConstExprInt = 42;
+
+
+//===----------------------------------------------------------------------===//
+// Redefined types
+//===----------------------------------------------------------------------===//
+typedef int INDEX;
+INDEX iIndex = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for global variable 'iIndex' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}INDEX Index = 0;
+
+
+//===----------------------------------------------------------------------===//
+// Class
+//===----------------------------------------------------------------------===//
+class ClassCase { int Func(); };
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for class 'ClassCase' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}class CClassCase { int Func(); };
+
+class AbstractClassCase { virtual int Func() = 0; };
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for abstract class 'AbstractClassCase' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}class IAbstractClassCase { virtual int Func() = 0; };
+
+class AbstractClassCase1 { virtual int Func1() = 0; int Func2(); };
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for abstract class 'AbstractClassCase1' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}class IAbstractClassCase1 { virtual int Func1() = 0; int Func2(); };
+
+class ClassConstantCase { public: static const int iConstantCase; };
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for class 'ClassConstantCase' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}class CClassConstantCase { public: static const int iConstantCase; };
+
+//===----------------------------------------------------------------------===//
+// Other Cases
+//===----------------------------------------------------------------------===//
+int lower_case = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'lower_case' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int iLowerCase = 0;
+
+int lower_case1 = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'lower_case1' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int iLowerCase1 = 0;
+
+int lower_case_2 = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'lower_case_2' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int iLowerCase2 = 0;
+
+int UPPER_CASE = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'UPPER_CASE' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int iUpperCase = 0;
+
+int UPPER_CASE_1 = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'UPPER_CASE_1' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int iUpperCase1 = 0;
+
+int camelBack = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'camelBack' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int iCamelBack = 0;
+
+int camelBack_1 = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'camelBack_1' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int iCamelBack1 = 0;
+
+int camelBack2 = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'camelBack2' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int iCamelBack2 = 0;
+
+int CamelCase = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'CamelCase' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int iCamelCase = 0;
+
+int CamelCase_1 = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'CamelCase_1' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int iCamelCase1 = 0;
+
+int CamelCase2 = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'CamelCase2' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int iCamelCase2 = 0;
+
+int camel_Snake_Back = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'camel_Snake_Back' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int iCamelSnakeBack = 0;
+
+int camel_Snake_Back_1 = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'camel_Snake_Back_1' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int iCamelSnakeBack1 = 0;
+
+int Camel_Snake_Case = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'Camel_Snake_Case' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int iCamelSnakeCase = 0;
+
+int Camel_Snake_Case_1 = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'Camel_Snake_Case_1' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}int iCamelSnakeCase1 = 0;
+
+//===----------------------------------------------------------------------===//
+// Enum
+//===----------------------------------------------------------------------===//
+enum REV_TYPE { RevValid };
+// CHECK-MESSAGES: :[[@LINE-1]]:17: warning: invalid case style for enum constant 'RevValid' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}enum REV_TYPE { rtRevValid };
+
+enum EnumConstantCase { OneByte, TwoByte };
+// CHECK-MESSAGES: :[[@LINE-1]]:25: warning: invalid case style for enum constant 'OneByte' [readability-identifier-naming]
+// CHECK-MESSAGES: :[[@LINE-2]]:34: warning: invalid case style for enum constant 'TwoByte' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}enum EnumConstantCase { eccOneByte, eccTwoByte };
+
+enum class ScopedEnumConstantCase { Case1 };
+// CHECK-MESSAGES: :[[@LINE-1]]:37: warning: invalid case style for scoped enum constant 'Case1' [readability-identifier-naming]
+// CHECK-FIXES: {{^}}enum class ScopedEnumConstantCase { seccCase1 };
+// clang-format on
More information about the cfe-commits
mailing list