diff --git a/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp b/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp --- a/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp +++ b/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp @@ -8,6 +8,7 @@ #include "RenamerClangTidyCheck.h" #include "ASTUtils.h" +#include "clang/AST/ASTFwd.h" #include "clang/AST/CXXInheritance.h" #include "clang/ASTMatchers/ASTMatchFinder.h" #include "clang/Frontend/CompilerInstance.h" @@ -272,6 +273,13 @@ } if (const auto *Decl = Result.Nodes.getNodeAs("decl")) { + + // fix using namespace decls + if (const auto *UsingNS = dyn_cast(Decl)) { + addUsage(NamingCheckFailures, UsingNS->getNominatedNamespaceAsWritten(), + UsingNS->getIdentLocation()); + } + if (!Decl->getIdentifier() || Decl->getName().empty() || Decl->isImplicit()) return; diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming.cpp --- a/clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming.cpp @@ -527,3 +527,8 @@ // CHECK-FIXES: {{^}} int * const lc_PointerB = nullptr;{{$}} } +using namespace FOO_NS; +// CHECK-FIXES: {{^}}using namespace foo_ns; + +using namespace FOO_NS::InlineNamespace; +// CHECK-FIXES: {{^}}using namespace foo_ns::inline_namespace;