Index: clang-tidy/google/AvoidCStyleCastsCheck.h =================================================================== --- clang-tidy/google/AvoidCStyleCastsCheck.h +++ clang-tidy/google/AvoidCStyleCastsCheck.h @@ -14,7 +14,7 @@ namespace clang { namespace tidy { -namespace readability { +namespace google { /// \brief Finds usages of C-style casts. /// @@ -32,7 +32,7 @@ void check(const ast_matchers::MatchFinder::MatchResult &Result) override; }; -} // namespace readability +} // namespace google } // namespace tidy } // namespace clang Index: clang-tidy/google/AvoidCStyleCastsCheck.cpp =================================================================== --- clang-tidy/google/AvoidCStyleCastsCheck.cpp +++ clang-tidy/google/AvoidCStyleCastsCheck.cpp @@ -17,7 +17,7 @@ namespace clang { namespace tidy { -namespace readability { +namespace google { void AvoidCStyleCastsCheck::registerMatchers(ast_matchers::MatchFinder *Finder) { @@ -160,6 +160,6 @@ diag_builder << "Use static_cast/const_cast/reinterpret_cast"; } -} // namespace readability +} // namespace google } // namespace tidy } // namespace clang Index: clang-tidy/google/ExplicitConstructorCheck.h =================================================================== --- clang-tidy/google/ExplicitConstructorCheck.h +++ clang-tidy/google/ExplicitConstructorCheck.h @@ -14,6 +14,7 @@ namespace clang { namespace tidy { +namespace google { /// \brief Checks that all single-argument constructors are explicit. /// @@ -27,6 +28,7 @@ void check(const ast_matchers::MatchFinder::MatchResult &Result) override; }; +} // namespace google } // namespace tidy } // namespace clang Index: clang-tidy/google/ExplicitConstructorCheck.cpp =================================================================== --- clang-tidy/google/ExplicitConstructorCheck.cpp +++ clang-tidy/google/ExplicitConstructorCheck.cpp @@ -17,6 +17,7 @@ namespace clang { namespace tidy { +namespace google { void ExplicitConstructorCheck::registerMatchers(MatchFinder *Finder) { Finder->addMatcher(constructorDecl(unless(isInstantiated())).bind("ctor"), @@ -117,5 +118,6 @@ << FixItHint::CreateInsertion(Loc, "explicit "); } +} // namespace google } // namespace tidy } // namespace clang Index: clang-tidy/google/ExplicitMakePairCheck.h =================================================================== --- clang-tidy/google/ExplicitMakePairCheck.h +++ clang-tidy/google/ExplicitMakePairCheck.h @@ -14,7 +14,7 @@ namespace clang { namespace tidy { -namespace build { +namespace google { /// \brief Check that make_pair's template arguments are deduced. /// @@ -30,7 +30,7 @@ void check(const ast_matchers::MatchFinder::MatchResult &Result) override; }; -} // namespace build +} // namespace google } // namespace tidy } // namespace clang Index: clang-tidy/google/ExplicitMakePairCheck.cpp =================================================================== --- clang-tidy/google/ExplicitMakePairCheck.cpp +++ clang-tidy/google/ExplicitMakePairCheck.cpp @@ -23,7 +23,7 @@ } // namespace ast_matchers namespace tidy { -namespace build { +namespace google { void ExplicitMakePairCheck::registerMatchers(ast_matchers::MatchFinder *Finder) { @@ -66,6 +66,6 @@ } } -} // namespace build +} // namespace google } // namespace tidy } // namespace clang Index: clang-tidy/google/GlobalNamesInHeadersCheck.h =================================================================== --- clang-tidy/google/GlobalNamesInHeadersCheck.h +++ clang-tidy/google/GlobalNamesInHeadersCheck.h @@ -14,7 +14,7 @@ namespace clang { namespace tidy { -namespace readability { +namespace google { // Flag global namespace pollution in header files. // Right now it only triggers on using declarations and directives. @@ -26,9 +26,8 @@ void check(const ast_matchers::MatchFinder::MatchResult &Result) override; }; -} // namespace readability +} // namespace google } // namespace tidy } // namespace clang #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GOOGLE_GLOBAL_NAMES_IN_HEADERS_CHECK_H - Index: clang-tidy/google/GlobalNamesInHeadersCheck.cpp =================================================================== --- clang-tidy/google/GlobalNamesInHeadersCheck.cpp +++ clang-tidy/google/GlobalNamesInHeadersCheck.cpp @@ -17,7 +17,7 @@ namespace clang { namespace tidy { -namespace readability { +namespace google { void GlobalNamesInHeadersCheck::registerMatchers(ast_matchers::MatchFinder *Finder) { @@ -48,6 +48,6 @@ "using declarations in the global namespace in headers are prohibited"); } -} // namespace readability +} // namespace google } // namespace tidy } // namespace clang Index: clang-tidy/google/GoogleTidyModule.cpp =================================================================== --- clang-tidy/google/GoogleTidyModule.cpp +++ clang-tidy/google/GoogleTidyModule.cpp @@ -31,35 +31,34 @@ namespace clang { namespace tidy { +namespace google { class GoogleModule : public ClangTidyModule { public: void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override { - CheckFactories.registerCheck( + CheckFactories.registerCheck( "google-build-explicit-make-pair"); - CheckFactories.registerCheck( + CheckFactories.registerCheck( "google-build-namespaces"); - CheckFactories.registerCheck( + CheckFactories.registerCheck( "google-build-using-namespace"); CheckFactories.registerCheck( "google-explicit-constructor"); - CheckFactories.registerCheck( - "google-runtime-int"); - CheckFactories.registerCheck( + CheckFactories.registerCheck("google-runtime-int"); + CheckFactories.registerCheck( "google-runtime-operator"); - CheckFactories.registerCheck( + CheckFactories.registerCheck( "google-runtime-member-string-references"); - CheckFactories.registerCheck( + CheckFactories.registerCheck( "google-runtime-memset"); - CheckFactories.registerCheck( + CheckFactories.registerCheck( "google-readability-casting"); - CheckFactories.registerCheck( + CheckFactories.registerCheck( "google-readability-function"); - CheckFactories.registerCheck( - "google-readability-todo"); + CheckFactories.registerCheck("google-readability-todo"); CheckFactories.registerCheck( "google-readability-braces-around-statements"); - CheckFactories.registerCheck( + CheckFactories.registerCheck( "google-global-names-in-headers"); CheckFactories.registerCheck( "google-readability-function-size"); @@ -81,9 +80,11 @@ } }; +} // namespace google + // Register the GoogleTidyModule using this statically initialized variable. -static ClangTidyModuleRegistry::Add X("google-module", - "Adds Google lint checks."); +static ClangTidyModuleRegistry::Add + X("google-module", "Adds Google lint checks."); // This anchor is used to force the linker to link in the generated object file // and thus register the GoogleModule. Index: clang-tidy/google/IntegerTypesCheck.h =================================================================== --- clang-tidy/google/IntegerTypesCheck.h +++ clang-tidy/google/IntegerTypesCheck.h @@ -14,7 +14,7 @@ namespace clang { namespace tidy { -namespace runtime { +namespace google { /// \brief Finds uses of short, long and long long and suggest replacing them /// with u?intXX(_t)?. @@ -33,7 +33,7 @@ const bool AddUnderscoreT; }; -} // namespace runtime +} // namespace google } // namespace tidy } // namespace clang Index: clang-tidy/google/IntegerTypesCheck.cpp =================================================================== --- clang-tidy/google/IntegerTypesCheck.cpp +++ clang-tidy/google/IntegerTypesCheck.cpp @@ -16,7 +16,7 @@ namespace clang { namespace tidy { -namespace runtime { +namespace google { using namespace ast_matchers; @@ -97,6 +97,6 @@ << Replacement; } -} // namespace runtime +} // namespace google } // namespace tidy } // namespace clang Index: clang-tidy/google/MemsetZeroLengthCheck.h =================================================================== --- clang-tidy/google/MemsetZeroLengthCheck.h +++ clang-tidy/google/MemsetZeroLengthCheck.h @@ -14,7 +14,7 @@ namespace clang { namespace tidy { -namespace runtime { +namespace google { /// \brief Finds calls to memset with a literal zero in the length argument. /// @@ -30,7 +30,7 @@ void check(const ast_matchers::MatchFinder::MatchResult &Result) override; }; -} // namespace runtime +} // namespace google } // namespace tidy } // namespace clang Index: clang-tidy/google/MemsetZeroLengthCheck.cpp =================================================================== --- clang-tidy/google/MemsetZeroLengthCheck.cpp +++ clang-tidy/google/MemsetZeroLengthCheck.cpp @@ -17,7 +17,7 @@ namespace clang { namespace tidy { -namespace runtime { +namespace google { void MemsetZeroLengthCheck::registerMatchers(ast_matchers::MatchFinder *Finder) { @@ -84,6 +84,6 @@ LHSString); } -} // namespace runtime +} // namespace google } // namespace tidy } // namespace clang Index: clang-tidy/google/NamedParameterCheck.h =================================================================== --- clang-tidy/google/NamedParameterCheck.h +++ clang-tidy/google/NamedParameterCheck.h @@ -14,7 +14,7 @@ namespace clang { namespace tidy { -namespace readability { +namespace google { /// \brief Find functions with unnamed arguments. /// @@ -28,7 +28,7 @@ void check(const ast_matchers::MatchFinder::MatchResult &Result) override; }; -} // namespace readability +} // namespace google } // namespace tidy } // namespace clang Index: clang-tidy/google/NamedParameterCheck.cpp =================================================================== --- clang-tidy/google/NamedParameterCheck.cpp +++ clang-tidy/google/NamedParameterCheck.cpp @@ -16,7 +16,7 @@ namespace clang { namespace tidy { -namespace readability { +namespace google { void NamedParameterCheck::registerMatchers(ast_matchers::MatchFinder *Finder) { Finder->addMatcher(functionDecl(unless(isInstantiated())).bind("decl"), this); @@ -120,6 +120,6 @@ } } -} // namespace readability +} // namespace google } // namespace tidy } // namespace clang Index: clang-tidy/google/OverloadedUnaryAndCheck.h =================================================================== --- clang-tidy/google/OverloadedUnaryAndCheck.h +++ clang-tidy/google/OverloadedUnaryAndCheck.h @@ -14,7 +14,7 @@ namespace clang { namespace tidy { -namespace runtime { +namespace google { /// \brief Finds overloads of unary operator &. /// @@ -28,7 +28,7 @@ void check(const ast_matchers::MatchFinder::MatchResult &Result) override; }; -} // namespace runtime +} // namespace google } // namespace tidy } // namespace clang Index: clang-tidy/google/OverloadedUnaryAndCheck.cpp =================================================================== --- clang-tidy/google/OverloadedUnaryAndCheck.cpp +++ clang-tidy/google/OverloadedUnaryAndCheck.cpp @@ -16,7 +16,7 @@ namespace clang { namespace tidy { -namespace runtime { +namespace google { void OverloadedUnaryAndCheck::registerMatchers(ast_matchers::MatchFinder *Finder) { @@ -40,6 +40,6 @@ "do not overload unary operator&, it is dangerous."); } -} // namespace runtime +} // namespace google } // namespace tidy } // namespace clang Index: clang-tidy/google/StringReferenceMemberCheck.h =================================================================== --- clang-tidy/google/StringReferenceMemberCheck.h +++ clang-tidy/google/StringReferenceMemberCheck.h @@ -14,7 +14,7 @@ namespace clang { namespace tidy { -namespace runtime { +namespace google { /// \brief Finds members of type 'const string&'. /// @@ -45,7 +45,7 @@ void check(const ast_matchers::MatchFinder::MatchResult &Result) override; }; -} // namespace runtime +} // namespace google } // namespace tidy } // namespace clang Index: clang-tidy/google/StringReferenceMemberCheck.cpp =================================================================== --- clang-tidy/google/StringReferenceMemberCheck.cpp +++ clang-tidy/google/StringReferenceMemberCheck.cpp @@ -16,7 +16,7 @@ namespace clang { namespace tidy { -namespace runtime { +namespace google { void StringReferenceMemberCheck::registerMatchers( ast_matchers::MatchFinder *Finder) { @@ -39,6 +39,6 @@ "simple constants."); } -} // namespace runtime +} // namespace google } // namespace tidy } // namespace clang Index: clang-tidy/google/TodoCommentCheck.h =================================================================== --- clang-tidy/google/TodoCommentCheck.h +++ clang-tidy/google/TodoCommentCheck.h @@ -14,7 +14,7 @@ namespace clang { namespace tidy { -namespace readability { +namespace google { /// \brief Finds TODO comments without a username or bug number. /// @@ -29,7 +29,7 @@ std::unique_ptr Handler; }; -} // namespace readability +} // namespace google } // namespace tidy } // namespace clang Index: clang-tidy/google/TodoCommentCheck.cpp =================================================================== --- clang-tidy/google/TodoCommentCheck.cpp +++ clang-tidy/google/TodoCommentCheck.cpp @@ -13,7 +13,7 @@ namespace clang { namespace tidy { -namespace readability { +namespace google { class TodoCommentCheck::TodoCommentHandler : public CommentHandler { public: @@ -59,6 +59,6 @@ Compiler.getPreprocessor().addCommentHandler(Handler.get()); } -} // namespace readability +} // namespace google } // namespace tidy } // namespace clang Index: clang-tidy/google/UnnamedNamespaceInHeaderCheck.h =================================================================== --- clang-tidy/google/UnnamedNamespaceInHeaderCheck.h +++ clang-tidy/google/UnnamedNamespaceInHeaderCheck.h @@ -14,7 +14,7 @@ namespace clang { namespace tidy { -namespace build { +namespace google { /// \brief Finds anonymous namespaces in headers. /// @@ -28,7 +28,7 @@ void check(const ast_matchers::MatchFinder::MatchResult &Result) override; }; -} // namespace build +} // namespace google } // namespace tidy } // namespace clang Index: clang-tidy/google/UnnamedNamespaceInHeaderCheck.cpp =================================================================== --- clang-tidy/google/UnnamedNamespaceInHeaderCheck.cpp +++ clang-tidy/google/UnnamedNamespaceInHeaderCheck.cpp @@ -22,7 +22,7 @@ } // namespace ast_matchers namespace tidy { -namespace build { +namespace google { void UnnamedNamespaceInHeaderCheck::registerMatchers( ast_matchers::MatchFinder *Finder) { @@ -46,6 +46,6 @@ diag(Loc, "do not use unnamed namespaces in header files."); } -} // namespace build +} // namespace google } // namespace tidy } // namespace clang Index: clang-tidy/google/UsingNamespaceDirectiveCheck.h =================================================================== --- clang-tidy/google/UsingNamespaceDirectiveCheck.h +++ clang-tidy/google/UsingNamespaceDirectiveCheck.h @@ -14,7 +14,7 @@ namespace clang { namespace tidy { -namespace build { +namespace google { /// \brief Finds using namespace directives. /// @@ -28,7 +28,7 @@ void check(const ast_matchers::MatchFinder::MatchResult &Result) override; }; -} // namespace build +} // namespace google } // namespace tidy } // namespace clang Index: clang-tidy/google/UsingNamespaceDirectiveCheck.cpp =================================================================== --- clang-tidy/google/UsingNamespaceDirectiveCheck.cpp +++ clang-tidy/google/UsingNamespaceDirectiveCheck.cpp @@ -16,7 +16,7 @@ namespace clang { namespace tidy { -namespace build { +namespace google { void UsingNamespaceDirectiveCheck::registerMatchers( ast_matchers::MatchFinder *Finder) { @@ -36,6 +36,6 @@ // namespace directive. } -} // namespace build +} // namespace google } // namespace tidy } // namespace clang Index: unittests/clang-tidy/GoogleModuleTest.cpp =================================================================== --- unittests/clang-tidy/GoogleModuleTest.cpp +++ unittests/clang-tidy/GoogleModuleTest.cpp @@ -3,6 +3,8 @@ #include "google/GlobalNamesInHeadersCheck.h" #include "gtest/gtest.h" +using namespace clang::tidy::google; + namespace clang { namespace tidy { namespace test { @@ -70,7 +72,7 @@ if (!StringRef(Filename).endswith(".cpp")) { Args.emplace_back("-xc++-header"); } - test::runCheckOnCode( + test::runCheckOnCode( Header + Code, &Errors, Filename, Args); if (Errors.empty()) return false;