diff --git a/clang-tools-extra/clang-tidy/abseil/StringFindStartswithCheck.cpp b/clang-tools-extra/clang-tidy/abseil/StringFindStartswithCheck.cpp --- a/clang-tools-extra/clang-tidy/abseil/StringFindStartswithCheck.cpp +++ b/clang-tools-extra/clang-tidy/abseil/StringFindStartswithCheck.cpp @@ -26,8 +26,9 @@ : ClangTidyCheck(Name, Context), StringLikeClasses(utils::options::parseStringList( Options.get("StringLikeClasses", "::std::basic_string"))), - IncludeStyle(utils::IncludeSorter::parseIncludeStyle( - Options.getLocalOrGlobal("IncludeStyle", "llvm"))), + IncludeStyle(Options.getLocalOrGlobal("IncludeStyle", + utils::IncludeSorter::getMapping(), + utils::IncludeSorter::IS_LLVM)), AbseilStringsMatchHeader( Options.get("AbseilStringsMatchHeader", "absl/strings/match.h")) {} @@ -121,8 +122,8 @@ ClangTidyOptions::OptionMap &Opts) { Options.store(Opts, "StringLikeClasses", utils::options::serializeStringList(StringLikeClasses)); - Options.store(Opts, "IncludeStyle", - utils::IncludeSorter::toString(IncludeStyle)); + Options.store(Opts, "IncludeStyle", IncludeStyle, + utils::IncludeSorter::getMapping()); Options.store(Opts, "AbseilStringsMatchHeader", AbseilStringsMatchHeader); } diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/InitVariablesCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/InitVariablesCheck.cpp --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/InitVariablesCheck.cpp +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/InitVariablesCheck.cpp @@ -24,8 +24,9 @@ InitVariablesCheck::InitVariablesCheck(StringRef Name, ClangTidyContext *Context) : ClangTidyCheck(Name, Context), - IncludeStyle(utils::IncludeSorter::parseIncludeStyle( - Options.getLocalOrGlobal("IncludeStyle", "llvm"))), + IncludeStyle(Options.getLocalOrGlobal("IncludeStyle", + utils::IncludeSorter::getMapping(), + utils::IncludeSorter::IS_LLVM)), MathHeader(Options.get("MathHeader", "math.h")) {} void InitVariablesCheck::registerMatchers(MatchFinder *Finder) { diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp @@ -21,8 +21,9 @@ ProBoundsConstantArrayIndexCheck::ProBoundsConstantArrayIndexCheck( StringRef Name, ClangTidyContext *Context) : ClangTidyCheck(Name, Context), GslHeader(Options.get("GslHeader", "")), - IncludeStyle(utils::IncludeSorter::parseIncludeStyle( - Options.getLocalOrGlobal("IncludeStyle", "llvm"))) {} + IncludeStyle(Options.getLocalOrGlobal("IncludeStyle", + utils::IncludeSorter::getMapping(), + utils::IncludeSorter::IS_LLVM)) {} void ProBoundsConstantArrayIndexCheck::storeOptions( ClangTidyOptions::OptionMap &Opts) { diff --git a/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp b/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp --- a/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp +++ b/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp @@ -14,6 +14,7 @@ #include "clang/Basic/SourceLocation.h" #include "clang/Basic/SourceManager.h" #include "clang/Lex/Lexer.h" +#include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" #include "llvm/ADT/StringSwitch.h" @@ -43,6 +44,25 @@ static const char DerefByValueResultName[] = "derefByValueResult"; static const char DerefByRefResultName[] = "derefByRefResult"; +static ArrayRef> +getConfidenceMapping() { + static constexpr std::pair Mapping[] = { + {"reasonable", Confidence::CL_Reasonable}, + {"safe", Confidence::CL_Safe}, + {"risky", Confidence::CL_Risky}}; + return makeArrayRef(Mapping); +} + +static ArrayRef> +getStyleMapping() { + static constexpr std::pair Mapping[] = + {{"CamelCase", VariableNamer::NS_CamelCase}, + {"camelBack", VariableNamer::NS_CamelBack}, + {"lower_case", VariableNamer::NS_LowerCase}, + {"UPPER_CASE", VariableNamer::NS_UpperCase}}; + return makeArrayRef(Mapping); +} + // shared matchers static const TypeMatcher AnyType() { return anything(); } @@ -457,26 +477,15 @@ LoopConvertCheck::LoopConvertCheck(StringRef Name, ClangTidyContext *Context) : ClangTidyCheck(Name, Context), TUInfo(new TUTrackingInfo), MaxCopySize(std::stoull(Options.get("MaxCopySize", "16"))), - MinConfidence(StringSwitch( - Options.get("MinConfidence", "reasonable")) - .Case("safe", Confidence::CL_Safe) - .Case("risky", Confidence::CL_Risky) - .Default(Confidence::CL_Reasonable)), - NamingStyle(StringSwitch( - Options.get("NamingStyle", "CamelCase")) - .Case("camelBack", VariableNamer::NS_CamelBack) - .Case("lower_case", VariableNamer::NS_LowerCase) - .Case("UPPER_CASE", VariableNamer::NS_UpperCase) - .Default(VariableNamer::NS_CamelCase)) {} + MinConfidence(Options.get("MinConfidence", getConfidenceMapping(), + Confidence::CL_Reasonable)), + NamingStyle(Options.get("NamingStyle", getStyleMapping(), + VariableNamer::NS_CamelCase)) {} void LoopConvertCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) { Options.store(Opts, "MaxCopySize", std::to_string(MaxCopySize)); - SmallVector Confs{"risky", "reasonable", "safe"}; - Options.store(Opts, "MinConfidence", Confs[static_cast(MinConfidence)]); - - SmallVector Styles{"camelBack", "CamelCase", "lower_case", - "UPPER_CASE"}; - Options.store(Opts, "NamingStyle", Styles[static_cast(NamingStyle)]); + Options.store(Opts, "MinConfidence", MinConfidence, getConfidenceMapping()); + Options.store(Opts, "NamingStyle", NamingStyle, getStyleMapping()); } void LoopConvertCheck::registerMatchers(MatchFinder *Finder) { diff --git a/clang-tools-extra/clang-tidy/modernize/MakeSmartPtrCheck.cpp b/clang-tools-extra/clang-tidy/modernize/MakeSmartPtrCheck.cpp --- a/clang-tools-extra/clang-tidy/modernize/MakeSmartPtrCheck.cpp +++ b/clang-tools-extra/clang-tidy/modernize/MakeSmartPtrCheck.cpp @@ -41,12 +41,12 @@ const char MakeSmartPtrCheck::PointerType[] = "pointerType"; -MakeSmartPtrCheck::MakeSmartPtrCheck(StringRef Name, - ClangTidyContext* Context, +MakeSmartPtrCheck::MakeSmartPtrCheck(StringRef Name, ClangTidyContext *Context, StringRef MakeSmartPtrFunctionName) : ClangTidyCheck(Name, Context), - IncludeStyle(utils::IncludeSorter::parseIncludeStyle( - Options.getLocalOrGlobal("IncludeStyle", "llvm"))), + IncludeStyle(Options.getLocalOrGlobal("IncludeStyle", + utils::IncludeSorter::getMapping(), + utils::IncludeSorter::IS_LLVM)), MakeSmartPtrFunctionHeader( Options.get("MakeSmartPtrFunctionHeader", StdMemoryHeader)), MakeSmartPtrFunctionName( @@ -54,7 +54,8 @@ IgnoreMacros(Options.getLocalOrGlobal("IgnoreMacros", true)) {} void MakeSmartPtrCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) { - Options.store(Opts, "IncludeStyle", utils::IncludeSorter::toString(IncludeStyle)); + Options.store(Opts, "IncludeStyle", IncludeStyle, + utils::IncludeSorter::getMapping()); Options.store(Opts, "MakeSmartPtrFunctionHeader", MakeSmartPtrFunctionHeader); Options.store(Opts, "MakeSmartPtrFunction", MakeSmartPtrFunctionName); Options.store(Opts, "IgnoreMacros", IgnoreMacros); diff --git a/clang-tools-extra/clang-tidy/modernize/PassByValueCheck.cpp b/clang-tools-extra/clang-tidy/modernize/PassByValueCheck.cpp --- a/clang-tools-extra/clang-tidy/modernize/PassByValueCheck.cpp +++ b/clang-tools-extra/clang-tidy/modernize/PassByValueCheck.cpp @@ -120,13 +120,14 @@ PassByValueCheck::PassByValueCheck(StringRef Name, ClangTidyContext *Context) : ClangTidyCheck(Name, Context), - IncludeStyle(utils::IncludeSorter::parseIncludeStyle( - Options.getLocalOrGlobal("IncludeStyle", "llvm"))), + IncludeStyle(Options.getLocalOrGlobal("IncludeStyle", + utils::IncludeSorter::getMapping(), + utils::IncludeSorter::IS_LLVM)), ValuesOnly(Options.get("ValuesOnly", 0) != 0) {} void PassByValueCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) { - Options.store(Opts, "IncludeStyle", - utils::IncludeSorter::toString(IncludeStyle)); + Options.store(Opts, "IncludeStyle", IncludeStyle, + utils::IncludeSorter::getMapping()); Options.store(Opts, "ValuesOnly", ValuesOnly); } diff --git a/clang-tools-extra/clang-tidy/modernize/ReplaceAutoPtrCheck.cpp b/clang-tools-extra/clang-tidy/modernize/ReplaceAutoPtrCheck.cpp --- a/clang-tools-extra/clang-tidy/modernize/ReplaceAutoPtrCheck.cpp +++ b/clang-tools-extra/clang-tidy/modernize/ReplaceAutoPtrCheck.cpp @@ -74,12 +74,13 @@ ReplaceAutoPtrCheck::ReplaceAutoPtrCheck(StringRef Name, ClangTidyContext *Context) : ClangTidyCheck(Name, Context), - IncludeStyle(utils::IncludeSorter::parseIncludeStyle( - Options.getLocalOrGlobal("IncludeStyle", "llvm"))) {} + IncludeStyle(Options.getLocalOrGlobal("IncludeStyle", + utils::IncludeSorter::getMapping(), + utils::IncludeSorter::IS_LLVM)) {} void ReplaceAutoPtrCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) { - Options.store(Opts, "IncludeStyle", - utils::IncludeSorter::toString(IncludeStyle)); + Options.store(Opts, "IncludeStyle", IncludeStyle, + utils::IncludeSorter::getMapping()); } void ReplaceAutoPtrCheck::registerMatchers(MatchFinder *Finder) { diff --git a/clang-tools-extra/clang-tidy/modernize/ReplaceRandomShuffleCheck.cpp b/clang-tools-extra/clang-tidy/modernize/ReplaceRandomShuffleCheck.cpp --- a/clang-tools-extra/clang-tidy/modernize/ReplaceRandomShuffleCheck.cpp +++ b/clang-tools-extra/clang-tidy/modernize/ReplaceRandomShuffleCheck.cpp @@ -23,8 +23,9 @@ ReplaceRandomShuffleCheck::ReplaceRandomShuffleCheck(StringRef Name, ClangTidyContext *Context) : ClangTidyCheck(Name, Context), - IncludeStyle(utils::IncludeSorter::parseIncludeStyle( - Options.getLocalOrGlobal("IncludeStyle", "llvm"))) {} + IncludeStyle(Options.getLocalOrGlobal("IncludeStyle", + utils::IncludeSorter::getMapping(), + utils::IncludeSorter::IS_LLVM)) {} void ReplaceRandomShuffleCheck::registerMatchers(MatchFinder *Finder) { const auto Begin = hasArgument(0, expr()); @@ -48,8 +49,8 @@ void ReplaceRandomShuffleCheck::storeOptions( ClangTidyOptions::OptionMap &Opts) { - Options.store(Opts, "IncludeStyle", - utils::IncludeSorter::toString(IncludeStyle)); + Options.store(Opts, "IncludeStyle", IncludeStyle, + utils::IncludeSorter::getMapping()); } void ReplaceRandomShuffleCheck::check(const MatchFinder::MatchResult &Result) { diff --git a/clang-tools-extra/clang-tidy/performance/MoveConstructorInitCheck.cpp b/clang-tools-extra/clang-tidy/performance/MoveConstructorInitCheck.cpp --- a/clang-tools-extra/clang-tidy/performance/MoveConstructorInitCheck.cpp +++ b/clang-tools-extra/clang-tidy/performance/MoveConstructorInitCheck.cpp @@ -23,8 +23,9 @@ MoveConstructorInitCheck::MoveConstructorInitCheck(StringRef Name, ClangTidyContext *Context) : ClangTidyCheck(Name, Context), - IncludeStyle(utils::IncludeSorter::parseIncludeStyle( - Options.getLocalOrGlobal("IncludeStyle", "llvm"))) {} + IncludeStyle(Options.getLocalOrGlobal("IncludeStyle", + utils::IncludeSorter::getMapping(), + utils::IncludeSorter::IS_LLVM)) {} void MoveConstructorInitCheck::registerMatchers(MatchFinder *Finder) { Finder->addMatcher( @@ -94,8 +95,8 @@ } void MoveConstructorInitCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) { - Options.store(Opts, "IncludeStyle", - utils::IncludeSorter::toString(IncludeStyle)); + Options.store(Opts, "IncludeStyle", IncludeStyle, + utils::IncludeSorter::getMapping()); } } // namespace performance diff --git a/clang-tools-extra/clang-tidy/performance/TypePromotionInMathFnCheck.cpp b/clang-tools-extra/clang-tidy/performance/TypePromotionInMathFnCheck.cpp --- a/clang-tools-extra/clang-tidy/performance/TypePromotionInMathFnCheck.cpp +++ b/clang-tools-extra/clang-tidy/performance/TypePromotionInMathFnCheck.cpp @@ -31,8 +31,9 @@ TypePromotionInMathFnCheck::TypePromotionInMathFnCheck( StringRef Name, ClangTidyContext *Context) : ClangTidyCheck(Name, Context), - IncludeStyle(utils::IncludeSorter::parseIncludeStyle( - Options.getLocalOrGlobal("IncludeStyle", "llvm"))) {} + IncludeStyle(Options.getLocalOrGlobal("IncludeStyle", + utils::IncludeSorter::getMapping(), + utils::IncludeSorter::IS_LLVM)) {} void TypePromotionInMathFnCheck::registerPPCallbacks( const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) { @@ -43,8 +44,8 @@ void TypePromotionInMathFnCheck::storeOptions( ClangTidyOptions::OptionMap &Opts) { - Options.store(Opts, "IncludeStyle", - utils::IncludeSorter::toString(IncludeStyle)); + Options.store(Opts, "IncludeStyle", IncludeStyle, + utils::IncludeSorter::getMapping()); } void TypePromotionInMathFnCheck::registerMatchers(MatchFinder *Finder) { diff --git a/clang-tools-extra/clang-tidy/performance/UnnecessaryValueParamCheck.cpp b/clang-tools-extra/clang-tidy/performance/UnnecessaryValueParamCheck.cpp --- a/clang-tools-extra/clang-tidy/performance/UnnecessaryValueParamCheck.cpp +++ b/clang-tools-extra/clang-tidy/performance/UnnecessaryValueParamCheck.cpp @@ -67,8 +67,9 @@ UnnecessaryValueParamCheck::UnnecessaryValueParamCheck( StringRef Name, ClangTidyContext *Context) : ClangTidyCheck(Name, Context), - IncludeStyle(utils::IncludeSorter::parseIncludeStyle( - Options.getLocalOrGlobal("IncludeStyle", "llvm"))), + IncludeStyle(Options.getLocalOrGlobal("IncludeStyle", + utils::IncludeSorter::getMapping(), + utils::IncludeSorter::IS_LLVM)), AllowedTypes( utils::options::parseStringList(Options.get("AllowedTypes", ""))) {} @@ -175,8 +176,8 @@ void UnnecessaryValueParamCheck::storeOptions( ClangTidyOptions::OptionMap &Opts) { - Options.store(Opts, "IncludeStyle", - utils::IncludeSorter::toString(IncludeStyle)); + Options.store(Opts, "IncludeStyle", IncludeStyle, + utils::IncludeSorter::getMapping()); Options.store(Opts, "AllowedTypes", utils::options::serializeStringList(AllowedTypes)); } diff --git a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp --- a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp +++ b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp @@ -11,8 +11,10 @@ #include "clang/AST/CXXInheritance.h" #include "clang/Lex/PPCallbacks.h" #include "clang/Lex/Preprocessor.h" +#include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/DenseMapInfo.h" #include "llvm/Support/Debug.h" +#include "llvm/Support/Error.h" #include "llvm/Support/Format.h" #include "llvm/Support/Regex.h" @@ -97,6 +99,16 @@ #undef NAMING_KEYS // clang-format on +static constexpr std::pair + Mapping[] = { + {"aNy_CasE", IdentifierNamingCheck::CT_AnyCase}, + {"lower_case", IdentifierNamingCheck::CT_LowerCase}, + {"UPPER_CASE", IdentifierNamingCheck::CT_UpperCase}, + {"camelBack", IdentifierNamingCheck::CT_CamelBack}, + {"CamelCase", IdentifierNamingCheck::CT_CamelCase}, + {"Camel_Snake_Case", IdentifierNamingCheck::CT_CamelSnakeCase}, + {"camel_Snake_Back", IdentifierNamingCheck::CT_CamelSnakeBack}}; + namespace { /// Callback supplies macros to IdentifierNamingCheck::checkMacro class IdentifierNamingCheckPPCallbacks : public PPCallbacks { @@ -129,26 +141,26 @@ : RenamerClangTidyCheck(Name, Context), IgnoreFailedSplit(Options.get("IgnoreFailedSplit", 0)), IgnoreMainLikeFunctions(Options.get("IgnoreMainLikeFunctions", 0)) { - auto const fromString = [](StringRef Str) { - return llvm::StringSwitch>(Str) - .Case("aNy_CasE", CT_AnyCase) - .Case("lower_case", CT_LowerCase) - .Case("UPPER_CASE", CT_UpperCase) - .Case("camelBack", CT_CamelBack) - .Case("CamelCase", CT_CamelCase) - .Case("Camel_Snake_Case", CT_CamelSnakeCase) - .Case("camel_Snake_Back", CT_CamelSnakeBack) - .Default(llvm::None); - }; for (auto const &Name : StyleNames) { - auto const caseOptional = - fromString(Options.get((Name + "Case").str(), "")); + auto CaseOptional = [&]() -> llvm::Optional { + auto ValueOr = Options.get((Name + "Case").str(), makeArrayRef(Mapping)); + if (ValueOr) + return *ValueOr; + llvm::logAllUnhandledErrors( + llvm::handleErrors(ValueOr.takeError(), + [](const MissingOptionError &) -> llvm::Error { + return llvm::Error::success(); + }), + llvm::errs(), "warning: "); + return llvm::None; + }(); + auto prefix = Options.get((Name + "Prefix").str(), ""); auto postfix = Options.get((Name + "Suffix").str(), ""); - if (caseOptional || !prefix.empty() || !postfix.empty()) { - NamingStyles.push_back(NamingStyle(caseOptional, prefix, postfix)); + if (CaseOptional || !prefix.empty() || !postfix.empty()) { + NamingStyles.push_back(NamingStyle(CaseOptional, prefix, postfix)); } else { NamingStyles.push_back(llvm::None); } @@ -158,32 +170,11 @@ IdentifierNamingCheck::~IdentifierNamingCheck() = default; void IdentifierNamingCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) { - auto const toString = [](CaseType Type) { - switch (Type) { - case CT_AnyCase: - return "aNy_CasE"; - case CT_LowerCase: - return "lower_case"; - case CT_CamelBack: - return "camelBack"; - case CT_UpperCase: - return "UPPER_CASE"; - case CT_CamelCase: - return "CamelCase"; - case CT_CamelSnakeCase: - return "Camel_Snake_Case"; - case CT_CamelSnakeBack: - return "camel_Snake_Back"; - } - - llvm_unreachable("Unknown Case Type"); - }; - for (size_t i = 0; i < SK_Count; ++i) { if (NamingStyles[i]) { if (NamingStyles[i]->Case) { Options.store(Opts, (StyleNames[i] + "Case").str(), - toString(*NamingStyles[i]->Case)); + *NamingStyles[i]->Case, llvm::makeArrayRef(Mapping)); } Options.store(Opts, (StyleNames[i] + "Prefix").str(), NamingStyles[i]->Prefix); diff --git a/clang-tools-extra/clang-tidy/utils/IncludeSorter.h b/clang-tools-extra/clang-tidy/utils/IncludeSorter.h --- a/clang-tools-extra/clang-tidy/utils/IncludeSorter.h +++ b/clang-tools-extra/clang-tidy/utils/IncludeSorter.h @@ -25,11 +25,7 @@ /// Supported include styles. enum IncludeStyle { IS_LLVM = 0, IS_Google = 1 }; - /// Converts "llvm" to ``IS_LLVM``, otherwise returns ``IS_Google``. - static IncludeStyle parseIncludeStyle(const std::string &Value); - - /// Converts ``IncludeStyle`` to string representation. - static StringRef toString(IncludeStyle Style); + static ArrayRef> getMapping(); /// The classifications of inclusions, in the order they should be sorted. enum IncludeKinds { diff --git a/clang-tools-extra/clang-tidy/utils/IncludeSorter.cpp b/clang-tools-extra/clang-tidy/utils/IncludeSorter.cpp --- a/clang-tools-extra/clang-tidy/utils/IncludeSorter.cpp +++ b/clang-tools-extra/clang-tidy/utils/IncludeSorter.cpp @@ -275,13 +275,11 @@ return Fixes; } -IncludeSorter::IncludeStyle -IncludeSorter::parseIncludeStyle(const std::string &Value) { - return Value == "llvm" ? IS_LLVM : IS_Google; -} - -StringRef IncludeSorter::toString(IncludeStyle Style) { - return Style == IS_LLVM ? "llvm" : "google"; +llvm::ArrayRef> +IncludeSorter::getMapping() { + static constexpr std::pair Mapping[] = + {{"llvm", IS_LLVM}, {"google", IS_Google}}; + return makeArrayRef(Mapping); } } // namespace utils diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-case-violation.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-case-violation.cpp new file mode 100644 --- /dev/null +++ b/clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-case-violation.cpp @@ -0,0 +1,15 @@ +// RUN: clang-tidy %s -checks=readability-identifier-naming \ +// RUN: -config="{CheckOptions: [\ +// RUN: {key: readability-identifier-naming.FunctionCase, value: camelback}, \ +// RUN: {key: readability-identifier-naming.VariableCase, value: camelBack}, \ +// RUN: {key: readability-identifier-naming.ClassCase, value: UUPER_CASE}, \ +// RUN: {key: readability-identifier-naming.StructCase, value: CAMEL}, \ +// RUN: {key: readability-identifier-naming.EnumCase, value: AnY_cASe}, \ +// RUN: ]}" 2>&1 | FileCheck %s --implicit-check-not warning + +// CHECK-DAG: warning: invalid configuration value 'camelback' for option 'readability-identifier-naming.FunctionCase'; did you mean 'camelBack'?{{$}} +// CHECK-DAG: warning: invalid configuration value 'UUPER_CASE' for option 'readability-identifier-naming.ClassCase'; did you mean 'UPPER_CASE'?{{$}} +// Don't try to suggest an alternative for 'CAMEL' +// CHECK-DAG: warning: invalid configuration value 'CAMEL' for option 'readability-identifier-naming.StructCase'{{$}} +// This fails on the EditDistance, but as it matches ignoring case suggest the correct value +// CHECK-DAG: warning: invalid configuration value 'AnY_cASe' for option 'readability-identifier-naming.EnumCase'; did you mean 'aNy_CasE'?{{$}}