Index: clang-tidy/google/GlobalVariableDeclarationCheck.cpp =================================================================== --- clang-tidy/google/GlobalVariableDeclarationCheck.cpp +++ clang-tidy/google/GlobalVariableDeclarationCheck.cpp @@ -79,12 +79,16 @@ void GlobalVariableDeclarationCheck::check( const MatchFinder::MatchResult &Result) { if (const auto *Decl = Result.Nodes.getNodeAs("global_var")) { + if (Decl->isStaticDataMember()) + return; diag(Decl->getLocation(), "non-const global variable '%0' must have a name which starts with " "'g[A-Z]'") << Decl->getName() << generateFixItHint(Decl, false); } if (const auto *Decl = Result.Nodes.getNodeAs("global_const")) { + if (Decl->isStaticDataMember()) + return; diag(Decl->getLocation(), "const global variable '%0' must have a name which starts with " "an appropriate prefix") Index: test/clang-tidy/google-objc-global-variable-declaration.mm =================================================================== --- /dev/null +++ test/clang-tidy/google-objc-global-variable-declaration.mm @@ -0,0 +1,5 @@ +// RUN: %check_clang_tidy %s google-objc-global-variable-declaration %t + +class MyTest { + static int not_objc_style; +}; \ No newline at end of file