[clang-tidy] Refactor: Move google clang-tidy checks to namespace clang::tidy::google

http://reviews.llvm.org/D7994

Patch by Richard Thomson!

llvm-svn: 231364
This commit is contained in:
Alexander Kornienko 2015-03-05 13:46:14 +00:00
parent 18ca267d7a
commit ed824e0e4b
26 changed files with 63 additions and 8 deletions

View File

@ -17,6 +17,7 @@ using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace google {
namespace readability {
void
@ -161,5 +162,6 @@ void AvoidCStyleCastsCheck::check(const MatchFinder::MatchResult &Result) {
}
} // namespace readability
} // namespace google
} // namespace tidy
} // namespace clang

View File

@ -14,6 +14,7 @@
namespace clang {
namespace tidy {
namespace google {
namespace readability {
/// \brief Finds usages of C-style casts.
@ -33,6 +34,7 @@ public:
};
} // namespace readability
} // namespace google
} // namespace tidy
} // namespace clang

View File

@ -17,6 +17,7 @@ using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace google {
void ExplicitConstructorCheck::registerMatchers(MatchFinder *Finder) {
Finder->addMatcher(constructorDecl(unless(isInstantiated())).bind("ctor"),
@ -117,5 +118,6 @@ void ExplicitConstructorCheck::check(const MatchFinder::MatchResult &Result) {
<< FixItHint::CreateInsertion(Loc, "explicit ");
}
} // namespace google
} // namespace tidy
} // namespace clang

View File

@ -14,6 +14,7 @@
namespace clang {
namespace tidy {
namespace google {
/// \brief Checks that all single-argument constructors are explicit.
///
@ -27,6 +28,7 @@ public:
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};
} // namespace google
} // namespace tidy
} // namespace clang

View File

@ -23,6 +23,7 @@ AST_MATCHER(DeclRefExpr, hasExplicitTemplateArgs) {
} // namespace ast_matchers
namespace tidy {
namespace google {
namespace build {
void
@ -67,5 +68,6 @@ void ExplicitMakePairCheck::check(const MatchFinder::MatchResult &Result) {
}
} // namespace build
} // namespace google
} // namespace tidy
} // namespace clang

View File

@ -14,6 +14,7 @@
namespace clang {
namespace tidy {
namespace google {
namespace build {
/// \brief Check that make_pair's template arguments are deduced.
@ -31,6 +32,7 @@ public:
};
} // namespace build
} // namespace google
} // namespace tidy
} // namespace clang

View File

@ -17,6 +17,7 @@ using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace google {
namespace readability {
void
@ -49,5 +50,6 @@ void GlobalNamesInHeadersCheck::check(const MatchFinder::MatchResult &Result) {
}
} // namespace readability
} // namespace google
} // namespace tidy
} // namespace clang

View File

@ -14,6 +14,7 @@
namespace clang {
namespace tidy {
namespace google {
namespace readability {
// Flag global namespace pollution in header files.
@ -27,8 +28,8 @@ public:
};
} // namespace readability
} // namespace google
} // namespace tidy
} // namespace clang
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GOOGLE_GLOBAL_NAMES_IN_HEADERS_CHECK_H

View File

@ -31,6 +31,7 @@ using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace google {
class GoogleModule : public ClangTidyModule {
public:
@ -57,16 +58,19 @@ public:
"google-readability-function");
CheckFactories.registerCheck<readability::TodoCommentCheck>(
"google-readability-todo");
CheckFactories.registerCheck<readability::BracesAroundStatementsCheck>(
"google-readability-braces-around-statements");
CheckFactories
.registerCheck<clang::tidy::readability::BracesAroundStatementsCheck>(
"google-readability-braces-around-statements");
CheckFactories.registerCheck<readability::GlobalNamesInHeadersCheck>(
"google-global-names-in-headers");
CheckFactories.registerCheck<readability::FunctionSizeCheck>(
CheckFactories.registerCheck<clang::tidy::readability::FunctionSizeCheck>(
"google-readability-function-size");
CheckFactories.registerCheck<readability::NamespaceCommentCheck>(
"google-readability-namespace-comments");
CheckFactories.registerCheck<readability::RedundantSmartptrGet>(
"google-readability-redundant-smartptr-get");
CheckFactories
.registerCheck<clang::tidy::readability::NamespaceCommentCheck>(
"google-readability-namespace-comments");
CheckFactories
.registerCheck<clang::tidy::readability::RedundantSmartptrGet>(
"google-readability-redundant-smartptr-get");
}
ClangTidyOptions getModuleOptions() override {
@ -85,6 +89,8 @@ public:
static ClangTidyModuleRegistry::Add<GoogleModule> X("google-module",
"Adds Google lint checks.");
} // namespace google
// This anchor is used to force the linker to link in the generated object file
// and thus register the GoogleModule.
volatile int GoogleModuleAnchorSource = 0;

View File

@ -16,6 +16,7 @@
namespace clang {
namespace tidy {
namespace google {
namespace runtime {
using namespace ast_matchers;
@ -98,5 +99,6 @@ void IntegerTypesCheck::check(const MatchFinder::MatchResult &Result) {
}
} // namespace runtime
} // namespace google
} // namespace tidy
} // namespace clang

View File

@ -14,6 +14,7 @@
namespace clang {
namespace tidy {
namespace google {
namespace runtime {
/// \brief Finds uses of short, long and long long and suggest replacing them
@ -34,6 +35,7 @@ private:
};
} // namespace runtime
} // namespace google
} // namespace tidy
} // namespace clang

View File

@ -17,6 +17,7 @@ using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace google {
namespace runtime {
void
@ -85,5 +86,6 @@ void MemsetZeroLengthCheck::check(const MatchFinder::MatchResult &Result) {
}
} // namespace runtime
} // namespace google
} // namespace tidy
} // namespace clang

View File

@ -14,6 +14,7 @@
namespace clang {
namespace tidy {
namespace google {
namespace runtime {
/// \brief Finds calls to memset with a literal zero in the length argument.
@ -31,6 +32,7 @@ public:
};
} // namespace runtime
} // namespace google
} // namespace tidy
} // namespace clang

View File

@ -16,6 +16,7 @@ using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace google {
namespace readability {
void NamedParameterCheck::registerMatchers(ast_matchers::MatchFinder *Finder) {
@ -121,5 +122,6 @@ void NamedParameterCheck::check(const MatchFinder::MatchResult &Result) {
}
} // namespace readability
} // namespace google
} // namespace tidy
} // namespace clang

View File

@ -14,6 +14,7 @@
namespace clang {
namespace tidy {
namespace google {
namespace readability {
/// \brief Find functions with unnamed arguments.
@ -29,6 +30,7 @@ public:
};
} // namespace readability
} // namespace google
} // namespace tidy
} // namespace clang

View File

@ -16,6 +16,7 @@ using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace google {
namespace runtime {
void
@ -41,5 +42,6 @@ void OverloadedUnaryAndCheck::check(const MatchFinder::MatchResult &Result) {
}
} // namespace runtime
} // namespace google
} // namespace tidy
} // namespace clang

View File

@ -14,6 +14,7 @@
namespace clang {
namespace tidy {
namespace google {
namespace runtime {
/// \brief Finds overloads of unary operator &.
@ -29,6 +30,7 @@ public:
};
} // namespace runtime
} // namespace google
} // namespace tidy
} // namespace clang

View File

@ -16,6 +16,7 @@ using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace google {
namespace runtime {
void StringReferenceMemberCheck::registerMatchers(
@ -40,5 +41,6 @@ StringReferenceMemberCheck::check(const MatchFinder::MatchResult &Result) {
}
} // namespace runtime
} // namespace google
} // namespace tidy
} // namespace clang

View File

@ -14,6 +14,7 @@
namespace clang {
namespace tidy {
namespace google {
namespace runtime {
/// \brief Finds members of type 'const string&'.
@ -46,6 +47,7 @@ public:
};
} // namespace runtime
} // namespace google
} // namespace tidy
} // namespace clang

View File

@ -13,6 +13,7 @@
namespace clang {
namespace tidy {
namespace google {
namespace readability {
class TodoCommentCheck::TodoCommentHandler : public CommentHandler {
@ -60,5 +61,6 @@ void TodoCommentCheck::registerPPCallbacks(CompilerInstance &Compiler) {
}
} // namespace readability
} // namespace google
} // namespace tidy
} // namespace clang

View File

@ -14,6 +14,7 @@
namespace clang {
namespace tidy {
namespace google {
namespace readability {
/// \brief Finds TODO comments without a username or bug number.
@ -30,6 +31,7 @@ private:
};
} // namespace readability
} // namespace google
} // namespace tidy
} // namespace clang

View File

@ -22,6 +22,7 @@ AST_MATCHER(NamespaceDecl, isAnonymousNamespace) {
} // namespace ast_matchers
namespace tidy {
namespace google {
namespace build {
void UnnamedNamespaceInHeaderCheck::registerMatchers(
@ -47,5 +48,6 @@ UnnamedNamespaceInHeaderCheck::check(const MatchFinder::MatchResult &Result) {
}
} // namespace build
} // namespace google
} // namespace tidy
} // namespace clang

View File

@ -14,6 +14,7 @@
namespace clang {
namespace tidy {
namespace google {
namespace build {
/// \brief Finds anonymous namespaces in headers.
@ -29,6 +30,7 @@ public:
};
} // namespace build
} // namespace google
} // namespace tidy
} // namespace clang

View File

@ -16,6 +16,7 @@ using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace google {
namespace build {
void UsingNamespaceDirectiveCheck::registerMatchers(
@ -37,5 +38,6 @@ UsingNamespaceDirectiveCheck::check(const MatchFinder::MatchResult &Result) {
}
} // namespace build
} // namespace google
} // namespace tidy
} // namespace clang

View File

@ -14,6 +14,7 @@
namespace clang {
namespace tidy {
namespace google {
namespace build {
/// \brief Finds using namespace directives.
@ -29,6 +30,7 @@ public:
};
} // namespace build
} // namespace google
} // namespace tidy
} // namespace clang

View File

@ -3,6 +3,8 @@
#include "google/GlobalNamesInHeadersCheck.h"
#include "gtest/gtest.h"
using namespace clang::tidy::google;
namespace clang {
namespace tidy {
namespace test {