[cfe-dev] clang-tidy readability-identifier-naming does check only namespace declarations, but not usage?

Troll Berserker via cfe-dev cfe-dev at lists.llvm.org
Wed Mar 13 15:43:29 PDT 2019


When I apply
$ clang-tidy-7 -config='{Checks: "-*,readability-identifier-naming", CheckOptions: [{ key: readability-identifier-naming.NamespaceCase, value: lower_case }]}' ./test.cpp

where test.cpp is as follows:

namespace NameSpace {
	class C;
}
void f(const NameSpace::C&);

I get only one warning:
test.cpp:1:11: warning: invalid case style for namespace 'NameSpace' [readability-identifier-naming]
namespace NameSpace {
           ^~~~~~~~~
           name_space

I also expect toe get a warning about the function parameter type.

Whilst there is seem to be check for nested-name-specifiers:
   if (const auto *Loc =
           Result.Nodes.getNodeAs<NestedNameSpecifierLoc>("nestedNameLoc")) {
     if (NestedNameSpecifier *Spec = Loc->getNestedNameSpecifier()) {
       if (NamespaceDecl *Decl = Spec->getAsNamespace()) {
         addUsage(NamingCheckFailures, Decl, Loc->getLocalSourceRange());
         return;
       }
     }
   }
(https://github.com/llvm-mirror/clang-tools-extra/blob/release_70/clang-tidy/readability/IdentifierNamingCheck.cpp#L764-L772)
either I don't know how to activate it or it is not working.



More information about the cfe-dev mailing list