Skip to content

Commit b74b4fe

Browse files
committed
[clang-tidy][readability-identifier-naming] Support namespace aliases
Fixes: #109385
1 parent 4468d58 commit b74b4fe

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,6 +1135,9 @@ StyleKind IdentifierNamingCheck::findStyleKind(
11351135
if (isa<TypeAliasDecl>(D) && NamingStyles[SK_TypeAlias])
11361136
return SK_TypeAlias;
11371137

1138+
if (isa<NamespaceAliasDecl>(D) && NamingStyles[SK_Namespace])
1139+
return SK_Namespace;
1140+
11381141
if (const auto *Decl = dyn_cast<NamespaceDecl>(D)) {
11391142
if (Decl->isAnonymousNamespace())
11401143
return SK_Invalid;

clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ inline namespace InlineNamespace {
101101
// CHECK-MESSAGES: :[[@LINE-1]]:18: warning: invalid case style for inline namespace 'InlineNamespace'
102102
// CHECK-FIXES: {{^}}inline namespace inline_namespace {{{$}}
103103

104+
namespace FOO_ALIAS = FOO_NS;
105+
// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: invalid case style for namespace 'FOO_ALIAS' [readability-identifier-naming]
106+
// CHECK-FIXES: {{^}}namespace foo_alias = FOO_NS;{{$}}
107+
104108
SYSTEM_NS::structure g_s1;
105109
// NO warnings or fixes expected as SYSTEM_NS and structure are declared in a header file
106110

0 commit comments

Comments
 (0)