<div dir="ltr">Forgot to mention: patch by Juliusz Toczydłowski!</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 22, 2017 at 1:49 PM, Alexander Kornienko via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: alexfh<br>
Date: Wed Mar 22 07:49:58 2017<br>
New Revision: 298499<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=298499&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=298499&view=rev</a><br>
Log:<br>
[clang-tidy] modified identifier naming case to use CT_AnyCase for ignoring case style<br>
<br>
Summary:<br>
Using CaseType::CT_AnyCase for selected identifier results in inheriting case style setting from more basic identifier type.<br>
<br>
This patch changes CT_AnyCase behavior to ignore case style of specified identifier. If case style was not set, llvm::Optional will be used for keeping this information (llvm::Optional<>::hasVal), thus CT_AnyCase will no longer mean more general identifier style should be used.<br>
<br>
This eliminates false-positives when naming convention is not clear for specific areas of code (legacy, third party) or for selected types.<br>
<br>
Reviewers: berenm, alexfh<br>
<br>
Reviewed By: alexfh<br>
<br>
Subscribers: cfe-commits, JDevlieghere<br>
<br>
Differential Revision: <a href="https://reviews.llvm.org/D30931" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D30931</a><br>
<br>
Modified:<br>
clang-tools-extra/trunk/clang-<wbr>tidy/readability/<wbr>IdentifierNamingCheck.cpp<br>
clang-tools-extra/trunk/clang-<wbr>tidy/readability/<wbr>IdentifierNamingCheck.h<br>
<br>
Modified: clang-tools-extra/trunk/clang-<wbr>tidy/readability/<wbr>IdentifierNamingCheck.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp?rev=298499&r1=298498&r2=298499&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/clang-tools-extra/<wbr>trunk/clang-tidy/readability/<wbr>IdentifierNamingCheck.cpp?rev=<wbr>298499&r1=298498&r2=298499&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- clang-tools-extra/trunk/clang-<wbr>tidy/readability/<wbr>IdentifierNamingCheck.cpp (original)<br>
+++ clang-tools-extra/trunk/clang-<wbr>tidy/readability/<wbr>IdentifierNamingCheck.cpp Wed Mar 22 07:49:58 2017<br>
@@ -158,21 +158,28 @@ IdentifierNamingCheck::<wbr>IdentifierNamingC<br>
ClangTidyContext *Context)<br>
: ClangTidyCheck(Name, Context) {<br>
auto const fromString = [](StringRef Str) {<br>
- return llvm::StringSwitch<CaseType>(<wbr>Str)<br>
+ return llvm::StringSwitch<llvm::<wbr>Optional<CaseType> >(Str)<br>
+ .Case("aNy_CasE", CT_AnyCase)<br>
.Case("lower_case", CT_LowerCase)<br>
.Case("UPPER_CASE", CT_UpperCase)<br>
.Case("camelBack", CT_CamelBack)<br>
.Case("CamelCase", CT_CamelCase)<br>
.Case("Camel_Snake_Case", CT_CamelSnakeCase)<br>
.Case("camel_Snake_Back", CT_CamelSnakeBack)<br>
- .Default(CT_AnyCase);<br>
+ .Default(llvm::None);<br>
};<br>
<br>
for (auto const &Name : StyleNames) {<br>
- NamingStyles.push_back(<br>
- NamingStyle(fromString(<wbr>Options.get((Name + "Case").str(), "")),<br>
- Options.get((Name + "Prefix").str(), ""),<br>
- Options.get((Name + "Suffix").str(), "")));<br>
+ auto const caseOptional =<br>
+ fromString(Options.get((Name + "Case").str(), ""));<br>
+ auto prefix = Options.get((Name + "Prefix").str(), "");<br>
+ auto postfix = Options.get((Name + "Suffix").str(), "");<br>
+<br>
+ if (caseOptional || !prefix.empty() || !postfix.empty()) {<br>
+ NamingStyles.push_back(<wbr>NamingStyle(caseOptional, prefix, postfix));<br>
+ } else {<br>
+ NamingStyles.push_back(llvm::<wbr>None);<br>
+ }<br>
}<br>
<br>
IgnoreFailedSplit = Options.get("<wbr>IgnoreFailedSplit", 0);<br>
@@ -201,12 +208,16 @@ void IdentifierNamingCheck::<wbr>storeOptions<br>
};<br>
<br>
for (size_t i = 0; i < SK_Count; ++i) {<br>
- Options.store(Opts, (StyleNames[i] + "Case").str(),<br>
- toString(NamingStyles[i].Case)<wbr>);<br>
- Options.store(Opts, (StyleNames[i] + "Prefix").str(),<br>
- NamingStyles[i].Prefix);<br>
- Options.store(Opts, (StyleNames[i] + "Suffix").str(),<br>
- NamingStyles[i].Suffix);<br>
+ if (NamingStyles[i]) {<br>
+ if (NamingStyles[i]->Case) {<br>
+ Options.store(Opts, (StyleNames[i] + "Case").str(),<br>
+ toString(*NamingStyles[i]-><wbr>Case));<br>
+ }<br>
+ Options.store(Opts, (StyleNames[i] + "Prefix").str(),<br>
+ NamingStyles[i]->Prefix);<br>
+ Options.store(Opts, (StyleNames[i] + "Suffix").str(),<br>
+ NamingStyles[i]->Suffix);<br>
+ }<br>
}<br>
<br>
Options.store(Opts, "IgnoreFailedSplit", IgnoreFailedSplit);<br>
@@ -251,7 +262,8 @@ static bool matchesStyle(StringRef Name,<br>
else<br>
Matches = false;<br>
<br>
- if (!Matchers[static_cast<size_t><wbr>(Style.Case)].match(Name))<br>
+ if (Style.Case &&<br>
+ !Matchers[static_cast<size_t>(<wbr>*Style.Case)].match(Name))<br>
Matches = false;<br>
<br>
return Matches;<br>
@@ -354,38 +366,42 @@ static std::string fixupWithCase(StringR<br>
}<br>
<br>
static std::string fixupWithStyle(StringRef Name,<br>
- IdentifierNamingCheck::<wbr>NamingStyle Style) {<br>
- return Style.Prefix + fixupWithCase(Name, Style.Case) + Style.Suffix;<br>
+ const IdentifierNamingCheck::<wbr>NamingStyle &Style) {<br>
+ return Style.Prefix +<br>
+ fixupWithCase(Name, Style.Case.getValueOr(<br>
+ IdentifierNamingCheck::<wbr>CaseType::CT_AnyCase)) +<br>
+ Style.Suffix;<br>
}<br>
<br>
static StyleKind findStyleKind(<br>
const NamedDecl *D,<br>
- const std::vector<<wbr>IdentifierNamingCheck::<wbr>NamingStyle> &NamingStyles) {<br>
- if (isa<TypedefDecl>(D) && NamingStyles[SK_Typedef].<wbr>isSet())<br>
+ const std::vector<llvm::Optional<<wbr>IdentifierNamingCheck::<wbr>NamingStyle>><br>
+ &NamingStyles) {<br>
+ if (isa<TypedefDecl>(D) && NamingStyles[SK_Typedef])<br>
return SK_Typedef;<br>
<br>
- if (isa<TypeAliasDecl>(D) && NamingStyles[SK_TypeAlias].<wbr>isSet())<br>
+ if (isa<TypeAliasDecl>(D) && NamingStyles[SK_TypeAlias])<br>
return SK_TypeAlias;<br>
<br>
if (const auto *Decl = dyn_cast<NamespaceDecl>(D)) {<br>
if (Decl->isAnonymousNamespace())<br>
return SK_Invalid;<br>
<br>
- if (Decl->isInline() && NamingStyles[SK_<wbr>InlineNamespace].isSet())<br>
+ if (Decl->isInline() && NamingStyles[SK_<wbr>InlineNamespace])<br>
return SK_InlineNamespace;<br>
<br>
- if (NamingStyles[SK_Namespace].<wbr>isSet())<br>
+ if (NamingStyles[SK_Namespace])<br>
return SK_Namespace;<br>
}<br>
<br>
- if (isa<EnumDecl>(D) && NamingStyles[SK_Enum].isSet())<br>
+ if (isa<EnumDecl>(D) && NamingStyles[SK_Enum])<br>
return SK_Enum;<br>
<br>
if (isa<EnumConstantDecl>(D)) {<br>
- if (NamingStyles[SK_EnumConstant]<wbr>.isSet())<br>
+ if (NamingStyles[SK_EnumConstant]<wbr>)<br>
return SK_EnumConstant;<br>
<br>
- if (NamingStyles[SK_Constant].<wbr>isSet())<br>
+ if (NamingStyles[SK_Constant])<br>
return SK_Constant;<br>
<br>
return SK_Invalid;<br>
@@ -399,25 +415,25 @@ static StyleKind findStyleKind(<br>
return SK_Invalid;<br>
<br>
if (Decl->hasDefinition() && Decl->isAbstract() &&<br>
- NamingStyles[SK_AbstractClass]<wbr>.isSet())<br>
+ NamingStyles[SK_AbstractClass]<wbr>)<br>
return SK_AbstractClass;<br>
<br>
- if (Decl->isStruct() && NamingStyles[SK_Struct].isSet(<wbr>))<br>
+ if (Decl->isStruct() && NamingStyles[SK_Struct])<br>
return SK_Struct;<br>
<br>
- if (Decl->isStruct() && NamingStyles[SK_Class].isSet()<wbr>)<br>
+ if (Decl->isStruct() && NamingStyles[SK_Class])<br>
return SK_Class;<br>
<br>
- if (Decl->isClass() && NamingStyles[SK_Class].isSet()<wbr>)<br>
+ if (Decl->isClass() && NamingStyles[SK_Class])<br>
return SK_Class;<br>
<br>
- if (Decl->isClass() && NamingStyles[SK_Struct].isSet(<wbr>))<br>
+ if (Decl->isClass() && NamingStyles[SK_Struct])<br>
return SK_Struct;<br>
<br>
- if (Decl->isUnion() && NamingStyles[SK_Union].isSet()<wbr>)<br>
+ if (Decl->isUnion() && NamingStyles[SK_Union])<br>
return SK_Union;<br>
<br>
- if (Decl->isEnum() && NamingStyles[SK_Enum].isSet())<br>
+ if (Decl->isEnum() && NamingStyles[SK_Enum])<br>
return SK_Enum;<br>
<br>
return SK_Invalid;<br>
@@ -427,25 +443,26 @@ static StyleKind findStyleKind(<br>
QualType Type = Decl->getType();<br>
<br>
if (!Type.isNull() && Type.isLocalConstQualified() &&<br>
- NamingStyles[SK_<wbr>ConstantMember].isSet())<br>
+ NamingStyles[SK_<wbr>ConstantMember])<br>
return SK_ConstantMember;<br>
<br>
if (!Type.isNull() && Type.isLocalConstQualified() &&<br>
- NamingStyles[SK_Constant].<wbr>isSet())<br>
+ NamingStyles[SK_Constant])<br>
return SK_Constant;<br>
<br>
if (Decl->getAccess() == AS_private &&<br>
- NamingStyles[SK_PrivateMember]<wbr>.isSet())<br>
+ NamingStyles[SK_PrivateMember]<wbr>)<br>
return SK_PrivateMember;<br>
<br>
if (Decl->getAccess() == AS_protected &&<br>
- NamingStyles[SK_<wbr>ProtectedMember].isSet())<br>
+ NamingStyles[SK_<wbr>ProtectedMember])<br>
return SK_ProtectedMember;<br>
<br>
- if (Decl->getAccess() == AS_public && NamingStyles[SK_PublicMember].<wbr>isSet())<br>
+ if (Decl->getAccess() == AS_public &&<br>
+ NamingStyles[SK_PublicMember])<br>
return SK_PublicMember;<br>
<br>
- if (NamingStyles[SK_Member].<wbr>isSet())<br>
+ if (NamingStyles[SK_Member])<br>
return SK_Member;<br>
<br>
return SK_Invalid;<br>
@@ -454,21 +471,21 @@ static StyleKind findStyleKind(<br>
if (const auto *Decl = dyn_cast<ParmVarDecl>(D)) {<br>
QualType Type = Decl->getType();<br>
<br>
- if (Decl->isConstexpr() && NamingStyles[SK_<wbr>ConstexprVariable].isSet())<br>
+ if (Decl->isConstexpr() && NamingStyles[SK_<wbr>ConstexprVariable])<br>
return SK_ConstexprVariable;<br>
<br>
if (!Type.isNull() && Type.isLocalConstQualified() &&<br>
- NamingStyles[SK_<wbr>ConstantParameter].isSet())<br>
+ NamingStyles[SK_<wbr>ConstantParameter])<br>
return SK_ConstantParameter;<br>
<br>
if (!Type.isNull() && Type.isLocalConstQualified() &&<br>
- NamingStyles[SK_Constant].<wbr>isSet())<br>
+ NamingStyles[SK_Constant])<br>
return SK_Constant;<br>
<br>
- if (Decl->isParameterPack() && NamingStyles[SK_ParameterPack]<wbr>.isSet())<br>
+ if (Decl->isParameterPack() && NamingStyles[SK_ParameterPack]<wbr>)<br>
return SK_ParameterPack;<br>
<br>
- if (NamingStyles[SK_Parameter].<wbr>isSet())<br>
+ if (NamingStyles[SK_Parameter])<br>
return SK_Parameter;<br>
<br>
return SK_Invalid;<br>
@@ -477,51 +494,51 @@ static StyleKind findStyleKind(<br>
if (const auto *Decl = dyn_cast<VarDecl>(D)) {<br>
QualType Type = Decl->getType();<br>
<br>
- if (Decl->isConstexpr() && NamingStyles[SK_<wbr>ConstexprVariable].isSet())<br>
+ if (Decl->isConstexpr() && NamingStyles[SK_<wbr>ConstexprVariable])<br>
return SK_ConstexprVariable;<br>
<br>
if (!Type.isNull() && Type.isLocalConstQualified() &&<br>
- Decl->isStaticDataMember() && NamingStyles[SK_ClassConstant]<wbr>.isSet())<br>
+ Decl->isStaticDataMember() && NamingStyles[SK_ClassConstant]<wbr>)<br>
return SK_ClassConstant;<br>
<br>
if (!Type.isNull() && Type.isLocalConstQualified() &&<br>
- Decl->isFileVarDecl() && NamingStyles[SK_<wbr>GlobalConstant].isSet())<br>
+ Decl->isFileVarDecl() && NamingStyles[SK_<wbr>GlobalConstant])<br>
return SK_GlobalConstant;<br>
<br>
if (!Type.isNull() && Type.isLocalConstQualified() &&<br>
- Decl->isStaticLocal() && NamingStyles[SK_<wbr>StaticConstant].isSet())<br>
+ Decl->isStaticLocal() && NamingStyles[SK_<wbr>StaticConstant])<br>
return SK_StaticConstant;<br>
<br>
if (!Type.isNull() && Type.isLocalConstQualified() &&<br>
- Decl->isLocalVarDecl() && NamingStyles[SK_LocalConstant]<wbr>.isSet())<br>
+ Decl->isLocalVarDecl() && NamingStyles[SK_LocalConstant]<wbr>)<br>
return SK_LocalConstant;<br>
<br>
if (!Type.isNull() && Type.isLocalConstQualified() &&<br>
Decl-><wbr>isFunctionOrMethodVarDecl() &&<br>
- NamingStyles[SK_LocalConstant]<wbr>.isSet())<br>
+ NamingStyles[SK_LocalConstant]<wbr>)<br>
return SK_LocalConstant;<br>
<br>
if (!Type.isNull() && Type.isLocalConstQualified() &&<br>
- NamingStyles[SK_Constant].<wbr>isSet())<br>
+ NamingStyles[SK_Constant])<br>
return SK_Constant;<br>
<br>
- if (Decl->isStaticDataMember() && NamingStyles[SK_ClassMember].<wbr>isSet())<br>
+ if (Decl->isStaticDataMember() && NamingStyles[SK_ClassMember])<br>
return SK_ClassMember;<br>
<br>
- if (Decl->isFileVarDecl() && NamingStyles[SK_<wbr>GlobalVariable].isSet())<br>
+ if (Decl->isFileVarDecl() && NamingStyles[SK_<wbr>GlobalVariable])<br>
return SK_GlobalVariable;<br>
<br>
- if (Decl->isStaticLocal() && NamingStyles[SK_<wbr>StaticVariable].isSet())<br>
+ if (Decl->isStaticLocal() && NamingStyles[SK_<wbr>StaticVariable])<br>
return SK_StaticVariable;<br>
<br>
- if (Decl->isLocalVarDecl() && NamingStyles[SK_LocalVariable]<wbr>.isSet())<br>
+ if (Decl->isLocalVarDecl() && NamingStyles[SK_LocalVariable]<wbr>)<br>
return SK_LocalVariable;<br>
<br>
if (Decl-><wbr>isFunctionOrMethodVarDecl() &&<br>
- NamingStyles[SK_LocalVariable]<wbr>.isSet())<br>
+ NamingStyles[SK_LocalVariable]<wbr>)<br>
return SK_LocalVariable;<br>
<br>
- if (NamingStyles[SK_Variable].<wbr>isSet())<br>
+ if (NamingStyles[SK_Variable])<br>
return SK_Variable;<br>
<br>
return SK_Invalid;<br>
@@ -534,33 +551,34 @@ static StyleKind findStyleKind(<br>
Decl->size_overridden_methods(<wbr>) > 0)<br>
return SK_Invalid;<br>
<br>
- if (Decl->isConstexpr() && NamingStyles[SK_<wbr>ConstexprMethod].isSet())<br>
+ if (Decl->isConstexpr() && NamingStyles[SK_<wbr>ConstexprMethod])<br>
return SK_ConstexprMethod;<br>
<br>
- if (Decl->isConstexpr() && NamingStyles[SK_<wbr>ConstexprFunction].isSet())<br>
+ if (Decl->isConstexpr() && NamingStyles[SK_<wbr>ConstexprFunction])<br>
return SK_ConstexprFunction;<br>
<br>
- if (Decl->isStatic() && NamingStyles[SK_ClassMethod].<wbr>isSet())<br>
+ if (Decl->isStatic() && NamingStyles[SK_ClassMethod])<br>
return SK_ClassMethod;<br>
<br>
- if (Decl->isVirtual() && NamingStyles[SK_VirtualMethod]<wbr>.isSet())<br>
+ if (Decl->isVirtual() && NamingStyles[SK_VirtualMethod]<wbr>)<br>
return SK_VirtualMethod;<br>
<br>
if (Decl->getAccess() == AS_private &&<br>
- NamingStyles[SK_PrivateMethod]<wbr>.isSet())<br>
+ NamingStyles[SK_PrivateMethod]<wbr>)<br>
return SK_PrivateMethod;<br>
<br>
if (Decl->getAccess() == AS_protected &&<br>
- NamingStyles[SK_<wbr>ProtectedMethod].isSet())<br>
+ NamingStyles[SK_<wbr>ProtectedMethod])<br>
return SK_ProtectedMethod;<br>
<br>
- if (Decl->getAccess() == AS_public && NamingStyles[SK_PublicMethod].<wbr>isSet())<br>
+ if (Decl->getAccess() == AS_public &&<br>
+ NamingStyles[SK_PublicMethod])<br>
return SK_PublicMethod;<br>
<br>
- if (NamingStyles[SK_Method].<wbr>isSet())<br>
+ if (NamingStyles[SK_Method])<br>
return SK_Method;<br>
<br>
- if (NamingStyles[SK_Function].<wbr>isSet())<br>
+ if (NamingStyles[SK_Function])<br>
return SK_Function;<br>
<br>
return SK_Invalid;<br>
@@ -570,41 +588,41 @@ static StyleKind findStyleKind(<br>
if (Decl->isMain())<br>
return SK_Invalid;<br>
<br>
- if (Decl->isConstexpr() && NamingStyles[SK_<wbr>ConstexprFunction].isSet())<br>
+ if (Decl->isConstexpr() && NamingStyles[SK_<wbr>ConstexprFunction])<br>
return SK_ConstexprFunction;<br>
<br>
- if (Decl->isGlobal() && NamingStyles[SK_<wbr>GlobalFunction].isSet())<br>
+ if (Decl->isGlobal() && NamingStyles[SK_<wbr>GlobalFunction])<br>
return SK_GlobalFunction;<br>
<br>
- if (NamingStyles[SK_Function].<wbr>isSet())<br>
+ if (NamingStyles[SK_Function])<br>
return SK_Function;<br>
}<br>
<br>
if (isa<TemplateTypeParmDecl>(D)) {<br>
- if (NamingStyles[SK_<wbr>TypeTemplateParameter].isSet()<wbr>)<br>
+ if (NamingStyles[SK_<wbr>TypeTemplateParameter])<br>
return SK_TypeTemplateParameter;<br>
<br>
- if (NamingStyles[SK_<wbr>TemplateParameter].isSet())<br>
+ if (NamingStyles[SK_<wbr>TemplateParameter])<br>
return SK_TemplateParameter;<br>
<br>
return SK_Invalid;<br>
}<br>
<br>
if (isa<NonTypeTemplateParmDecl>(<wbr>D)) {<br>
- if (NamingStyles[SK_<wbr>ValueTemplateParameter].isSet(<wbr>))<br>
+ if (NamingStyles[SK_<wbr>ValueTemplateParameter])<br>
return SK_ValueTemplateParameter;<br>
<br>
- if (NamingStyles[SK_<wbr>TemplateParameter].isSet())<br>
+ if (NamingStyles[SK_<wbr>TemplateParameter])<br>
return SK_TemplateParameter;<br>
<br>
return SK_Invalid;<br>
}<br>
<br>
if (isa<TemplateTemplateParmDecl><wbr>(D)) {<br>
- if (NamingStyles[SK_<wbr>TemplateTemplateParameter].<wbr>isSet())<br>
+ if (NamingStyles[SK_<wbr>TemplateTemplateParameter])<br>
return SK_TemplateTemplateParameter;<br>
<br>
- if (NamingStyles[SK_<wbr>TemplateParameter].isSet())<br>
+ if (NamingStyles[SK_<wbr>TemplateParameter])<br>
return SK_TemplateParameter;<br>
<br>
return SK_Invalid;<br>
@@ -807,7 +825,10 @@ void IdentifierNamingCheck::check(<wbr>const<br>
if (SK == SK_Invalid)<br>
return;<br>
<br>
- NamingStyle Style = NamingStyles[SK];<br>
+ if (!NamingStyles[SK])<br>
+ return;<br>
+<br>
+ const NamingStyle &Style = *NamingStyles[SK];<br>
StringRef Name = Decl->getName();<br>
if (matchesStyle(Name, Style))<br>
return;<br>
@@ -840,8 +861,11 @@ void IdentifierNamingCheck::check(<wbr>const<br>
void IdentifierNamingCheck::<wbr>checkMacro(SourceManager &SourceMgr,<br>
const Token &MacroNameTok,<br>
const MacroInfo *MI) {<br>
+ if (!NamingStyles[SK_<wbr>MacroDefinition])<br>
+ return;<br>
+<br>
StringRef Name = MacroNameTok.<wbr>getIdentifierInfo()->getName()<wbr>;<br>
- NamingStyle Style = NamingStyles[SK_<wbr>MacroDefinition];<br>
+ const NamingStyle &Style = *NamingStyles[SK_<wbr>MacroDefinition];<br>
if (matchesStyle(Name, Style))<br>
return;<br>
<br>
<br>
Modified: clang-tools-extra/trunk/clang-<wbr>tidy/readability/<wbr>IdentifierNamingCheck.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.h?rev=298499&r1=298498&r2=298499&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/clang-tools-extra/<wbr>trunk/clang-tidy/readability/<wbr>IdentifierNamingCheck.h?rev=<wbr>298499&r1=298498&r2=298499&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- clang-tools-extra/trunk/clang-<wbr>tidy/readability/<wbr>IdentifierNamingCheck.h (original)<br>
+++ clang-tools-extra/trunk/clang-<wbr>tidy/readability/<wbr>IdentifierNamingCheck.h Wed Mar 22 07:49:58 2017<br>
@@ -53,19 +53,16 @@ public:<br>
};<br>
<br>
struct NamingStyle {<br>
- NamingStyle() : Case(CT_AnyCase) {}<br>
+ NamingStyle() = default;<br>
<br>
- NamingStyle(CaseType Case, const std::string &Prefix,<br>
+ NamingStyle(llvm::Optional<<wbr>CaseType> Case,<br>
+ const std::string &Prefix,<br>
const std::string &Suffix)<br>
: Case(Case), Prefix(Prefix), Suffix(Suffix) {}<br>
<br>
- CaseType Case;<br>
+ llvm::Optional<CaseType> Case;<br>
std::string Prefix;<br>
std::string Suffix;<br>
-<br>
- bool isSet() const {<br>
- return !(Case == CT_AnyCase && Prefix.empty() && Suffix.empty());<br>
- }<br>
};<br>
<br>
/// \brief Holds an identifier name check failure, tracking the kind of the<br>
@@ -101,7 +98,7 @@ public:<br>
void expandMacro(const Token &MacroNameTok, const MacroInfo *MI);<br>
<br>
private:<br>
- std::vector<NamingStyle> NamingStyles;<br>
+ std::vector<llvm::Optional<<wbr>NamingStyle> > NamingStyles;<br>
bool IgnoreFailedSplit;<br>
NamingCheckFailureMap NamingCheckFailures;<br>
};<br>
<br>
<br>
______________________________<wbr>_________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>