Re: [PATCH] D20856: [clang-tidy] readability-identifier-naming - Support for Type Aliases

2016-06-07 Thread Alexander Kornienko via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL271992: [clang-tidy] readability-identifier-naming - Support 
for Type Aliases (authored by alexfh).

Changed prior to commit:
  http://reviews.llvm.org/D20856?vs=59189=59847#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20856

Files:
  clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
  clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming.cpp

Index: clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
===
--- clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
@@ -65,6 +65,7 @@
 m(ValueTemplateParameter) \
 m(TemplateTemplateParameter) \
 m(TemplateParameter) \
+m(TypeAlias) \
 
 enum StyleKind {
 #define ENUMERATE(v) SK_ ## v,
@@ -258,6 +259,9 @@
   if (isa(D) && NamingStyles[SK_Typedef].isSet())
 return SK_Typedef;
 
+  if (isa(D) && NamingStyles[SK_TypeAlias].isSet())
+return SK_TypeAlias;
+
   if (const auto *Decl = dyn_cast(D)) {
 if (Decl->isAnonymousNamespace())
   return SK_Invalid;
Index: clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming.cpp
===
--- clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming.cpp
+++ clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming.cpp
@@ -61,6 +61,8 @@
 // RUN: {key: readability-identifier-naming.VariableCase, value: 
lower_case}, \
 // RUN: {key: readability-identifier-naming.VirtualMethodCase, value: 
UPPER_CASE}, \
 // RUN: {key: readability-identifier-naming.VirtualMethodPrefix, value: 
'v_'}, \
+// RUN: {key: readability-identifier-naming.TypeAliasCase, value: 
lower_case}, \
+// RUN: {key: readability-identifier-naming.TypeAliasSuffix, value: '_t'}, 
\
 // RUN: {key: readability-identifier-naming.IgnoreFailedSplit, value: 0} \
 // RUN:   ]}' -- -std=c++11 -fno-delayed-template-parsing \
 // RUN:   -I%S/Inputs/readability-identifier-naming \
@@ -191,8 +193,8 @@
 // CHECK-FIXES: {{^}}class CMyOtherTemplatedClass : CMyTemplatedClass<  
CMyClass>, private CMyDerivedClass {};{{$}}
 
 template
-using MYSUPER_TPL = my_other_templated_class  <:: FOO_NS  ::my_class>;
-// CHECK-FIXES: {{^}}using MYSUPER_TPL = CMyOtherTemplatedClass  <:: foo_ns  
::CMyClass>;{{$}}
+using mysuper_tpl_t = my_other_templated_class  <:: FOO_NS  ::my_class>;
+// CHECK-FIXES: {{^}}using mysuper_tpl_t = CMyOtherTemplatedClass  <:: foo_ns  
::CMyClass>;{{$}}
 
 const int global_Constant = 6;
 // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: invalid case style for global 
constant 'global_Constant'
@@ -305,6 +307,15 @@
 // CHECK-MESSAGES: :[[@LINE-1]]:26: warning: invalid case style for typedef 
'struct_type'
 // CHECK-FIXES: {{^}}typedef this_structure struct_type_t;{{$}}
 
+using my_struct_type = THIS___Structure;
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for type alias 
'my_struct_type'
+// CHECK-FIXES: {{^}}using my_struct_type_t = this_structure;{{$}}
+
+template
+using SomeOtherTemplate = my_other_templated_class  <:: FOO_NS  ::my_class>;
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for type alias 
'SomeOtherTemplate'
+// CHECK-FIXES: {{^}}using some_other_template_t = CMyOtherTemplatedClass  <:: 
foo_ns  ::CMyClass>;{{$}}
+
 static void static_Function() {
 // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: invalid case style for function 
'static_Function'
 // CHECK-FIXES: {{^}}static void staticFunction() {{{$}}


Index: clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
===
--- clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
@@ -65,6 +65,7 @@
 m(ValueTemplateParameter) \
 m(TemplateTemplateParameter) \
 m(TemplateParameter) \
+m(TypeAlias) \
 
 enum StyleKind {
 #define ENUMERATE(v) SK_ ## v,
@@ -258,6 +259,9 @@
   if (isa(D) && NamingStyles[SK_Typedef].isSet())
 return SK_Typedef;
 
+  if (isa(D) && NamingStyles[SK_TypeAlias].isSet())
+return SK_TypeAlias;
+
   if (const auto *Decl = dyn_cast(D)) {
 if (Decl->isAnonymousNamespace())
   return SK_Invalid;
Index: clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming.cpp
===
--- clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming.cpp
+++ clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming.cpp
@@ -61,6 +61,8 @@
 // RUN: {key: readability-identifier-naming.VariableCase, value: lower_case}, \
 // RUN: {key: readability-identifier-naming.VirtualMethodCase, value: UPPER_CASE}, \
 // RUN: 

Re: [PATCH] D20856: [clang-tidy] readability-identifier-naming - Support for Type Aliases

2016-06-04 Thread James Reynolds via cfe-commits
JamesReynolds added a comment.

Great, and happy to help. I'm working on another couple that I should hopefully 
complete sometime next week. If you could commit this for me that would be 
great, thank you!


http://reviews.llvm.org/D20856



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20856: [clang-tidy] readability-identifier-naming - Support for Type Aliases

2016-06-03 Thread Alexander Kornienko via cfe-commits
alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.

Looks good. Thank you for the patch! Do you need me to submit it?


http://reviews.llvm.org/D20856



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits