Preserve child namespaces of `clang::tidy::google`
http://reviews.llvm.org/D7994
Files:
clang-tidy/google/AvoidCStyleCastsCheck.cpp
clang-tidy/google/AvoidCStyleCastsCheck.h
clang-tidy/google/ExplicitConstructorCheck.cpp
clang-tidy/google/ExplicitConstructorCheck.h
clang-tidy/google/ExplicitMakePairCheck.cpp
clang-tidy/google/ExplicitMakePairCheck.h
clang-tidy/google/GlobalNamesInHeadersCheck.cpp
clang-tidy/google/GlobalNamesInHeadersCheck.h
clang-tidy/google/GoogleTidyModule.cpp
clang-tidy/google/IntegerTypesCheck.cpp
clang-tidy/google/IntegerTypesCheck.h
clang-tidy/google/MemsetZeroLengthCheck.cpp
clang-tidy/google/MemsetZeroLengthCheck.h
clang-tidy/google/NamedParameterCheck.cpp
clang-tidy/google/NamedParameterCheck.h
clang-tidy/google/OverloadedUnaryAndCheck.cpp
clang-tidy/google/OverloadedUnaryAndCheck.h
clang-tidy/google/StringReferenceMemberCheck.cpp
clang-tidy/google/StringReferenceMemberCheck.h
clang-tidy/google/TodoCommentCheck.cpp
clang-tidy/google/TodoCommentCheck.h
clang-tidy/google/UnnamedNamespaceInHeaderCheck.cpp
clang-tidy/google/UnnamedNamespaceInHeaderCheck.h
clang-tidy/google/UsingNamespaceDirectiveCheck.cpp
clang-tidy/google/UsingNamespaceDirectiveCheck.h
unittests/clang-tidy/GoogleModuleTest.cpp
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
Index: clang-tidy/google/AvoidCStyleCastsCheck.cpp
===================================================================
--- clang-tidy/google/AvoidCStyleCastsCheck.cpp
+++ clang-tidy/google/AvoidCStyleCastsCheck.cpp
@@ -17,6 +17,7 @@
namespace clang {
namespace tidy {
+namespace google {
namespace readability {
void
@@ -161,5 +162,6 @@
}
} // namespace readability
+} // namespace google
} // namespace tidy
} // namespace clang
Index: clang-tidy/google/AvoidCStyleCastsCheck.h
===================================================================
--- clang-tidy/google/AvoidCStyleCastsCheck.h
+++ clang-tidy/google/AvoidCStyleCastsCheck.h
@@ -14,6 +14,7 @@
namespace clang {
namespace tidy {
+namespace google {
namespace readability {
/// \brief Finds usages of C-style casts.
@@ -33,6 +34,7 @@
};
} // namespace readability
+} // 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/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/ExplicitMakePairCheck.cpp
===================================================================
--- clang-tidy/google/ExplicitMakePairCheck.cpp
+++ clang-tidy/google/ExplicitMakePairCheck.cpp
@@ -23,6 +23,7 @@
} // namespace ast_matchers
namespace tidy {
+namespace google {
namespace build {
void
@@ -67,5 +68,6 @@
}
} // namespace build
+} // namespace google
} // namespace tidy
} // namespace clang
Index: clang-tidy/google/ExplicitMakePairCheck.h
===================================================================
--- clang-tidy/google/ExplicitMakePairCheck.h
+++ clang-tidy/google/ExplicitMakePairCheck.h
@@ -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 @@
};
} // namespace build
+} // namespace google
} // namespace tidy
} // namespace clang
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/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/GoogleTidyModule.cpp
===================================================================
--- clang-tidy/google/GoogleTidyModule.cpp
+++ clang-tidy/google/GoogleTidyModule.cpp
@@ -31,10 +31,12 @@
namespace clang {
namespace tidy {
+namespace google {
class GoogleModule : public ClangTidyModule {
public:
void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
+ using namespace clang::tidy;
CheckFactories.registerCheck<build::ExplicitMakePairCheck>(
"google-build-explicit-make-pair");
CheckFactories.registerCheck<build::UnnamedNamespaceInHeaderCheck>(
@@ -59,7 +61,7 @@
"google-readability-todo");
CheckFactories.registerCheck<readability::BracesAroundStatementsCheck>(
"google-readability-braces-around-statements");
- CheckFactories.registerCheck<readability::GlobalNamesInHeadersCheck>(
+ CheckFactories.registerCheck<GlobalNamesInHeadersCheck>(
"google-global-names-in-headers");
CheckFactories.registerCheck<readability::FunctionSizeCheck>(
"google-readability-function-size");
@@ -81,9 +83,11 @@
}
};
+} // namespace google
+
// Register the GoogleTidyModule using this statically initialized variable.
-static ClangTidyModuleRegistry::Add<GoogleModule> X("google-module",
- "Adds Google lint checks.");
+static ClangTidyModuleRegistry::Add<google::GoogleModule>
+ 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.cpp
===================================================================
--- clang-tidy/google/IntegerTypesCheck.cpp
+++ clang-tidy/google/IntegerTypesCheck.cpp
@@ -16,6 +16,7 @@
namespace clang {
namespace tidy {
+namespace google {
namespace runtime {
using namespace ast_matchers;
@@ -98,5 +99,6 @@
}
} // namespace runtime
+} // namespace google
} // namespace tidy
} // namespace clang
Index: clang-tidy/google/IntegerTypesCheck.h
===================================================================
--- clang-tidy/google/IntegerTypesCheck.h
+++ clang-tidy/google/IntegerTypesCheck.h
@@ -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 @@
};
} // 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,6 +17,7 @@
namespace clang {
namespace tidy {
+namespace google {
namespace runtime {
void
@@ -85,5 +86,6 @@
}
} // 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,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 @@
};
} // namespace runtime
+} // namespace google
} // namespace tidy
} // namespace clang
Index: clang-tidy/google/NamedParameterCheck.cpp
===================================================================
--- clang-tidy/google/NamedParameterCheck.cpp
+++ clang-tidy/google/NamedParameterCheck.cpp
@@ -16,6 +16,7 @@
namespace clang {
namespace tidy {
+namespace google {
namespace readability {
void NamedParameterCheck::registerMatchers(ast_matchers::MatchFinder *Finder) {
@@ -121,5 +122,6 @@
}
} // namespace readability
+} // namespace google
} // namespace tidy
} // namespace clang
Index: clang-tidy/google/NamedParameterCheck.h
===================================================================
--- clang-tidy/google/NamedParameterCheck.h
+++ clang-tidy/google/NamedParameterCheck.h
@@ -14,6 +14,7 @@
namespace clang {
namespace tidy {
+namespace google {
namespace readability {
/// \brief Find functions with unnamed arguments.
@@ -29,6 +30,7 @@
};
} // namespace readability
+} // namespace google
} // namespace tidy
} // namespace clang
Index: clang-tidy/google/OverloadedUnaryAndCheck.cpp
===================================================================
--- clang-tidy/google/OverloadedUnaryAndCheck.cpp
+++ clang-tidy/google/OverloadedUnaryAndCheck.cpp
@@ -16,6 +16,7 @@
namespace clang {
namespace tidy {
+namespace google {
namespace runtime {
void
@@ -41,5 +42,6 @@
}
} // namespace runtime
+} // namespace google
} // namespace tidy
} // namespace clang
Index: clang-tidy/google/OverloadedUnaryAndCheck.h
===================================================================
--- clang-tidy/google/OverloadedUnaryAndCheck.h
+++ clang-tidy/google/OverloadedUnaryAndCheck.h
@@ -14,6 +14,7 @@
namespace clang {
namespace tidy {
+namespace google {
namespace runtime {
/// \brief Finds overloads of unary operator &.
@@ -29,6 +30,7 @@
};
} // 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,6 +16,7 @@
namespace clang {
namespace tidy {
+namespace google {
namespace runtime {
void StringReferenceMemberCheck::registerMatchers(
@@ -40,5 +41,6 @@
}
} // 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,6 +14,7 @@
namespace clang {
namespace tidy {
+namespace google {
namespace runtime {
/// \brief Finds members of type 'const string&'.
@@ -46,6 +47,7 @@
};
} // namespace runtime
+} // namespace google
} // namespace tidy
} // namespace clang
Index: clang-tidy/google/TodoCommentCheck.cpp
===================================================================
--- clang-tidy/google/TodoCommentCheck.cpp
+++ clang-tidy/google/TodoCommentCheck.cpp
@@ -13,6 +13,7 @@
namespace clang {
namespace tidy {
+namespace google {
namespace readability {
class TodoCommentCheck::TodoCommentHandler : public CommentHandler {
@@ -60,5 +61,6 @@
}
} // namespace readability
+} // namespace google
} // namespace tidy
} // namespace clang
Index: clang-tidy/google/TodoCommentCheck.h
===================================================================
--- clang-tidy/google/TodoCommentCheck.h
+++ clang-tidy/google/TodoCommentCheck.h
@@ -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 @@
};
} // namespace readability
+} // namespace google
} // namespace tidy
} // namespace clang
Index: clang-tidy/google/UnnamedNamespaceInHeaderCheck.cpp
===================================================================
--- clang-tidy/google/UnnamedNamespaceInHeaderCheck.cpp
+++ clang-tidy/google/UnnamedNamespaceInHeaderCheck.cpp
@@ -22,6 +22,7 @@
} // namespace ast_matchers
namespace tidy {
+namespace google {
namespace build {
void UnnamedNamespaceInHeaderCheck::registerMatchers(
@@ -47,5 +48,6 @@
}
} // namespace build
+} // namespace google
} // namespace tidy
} // namespace clang
Index: clang-tidy/google/UnnamedNamespaceInHeaderCheck.h
===================================================================
--- clang-tidy/google/UnnamedNamespaceInHeaderCheck.h
+++ clang-tidy/google/UnnamedNamespaceInHeaderCheck.h
@@ -14,6 +14,7 @@
namespace clang {
namespace tidy {
+namespace google {
namespace build {
/// \brief Finds anonymous namespaces in headers.
@@ -29,6 +30,7 @@
};
} // 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,6 +16,7 @@
namespace clang {
namespace tidy {
+namespace google {
namespace build {
void UsingNamespaceDirectiveCheck::registerMatchers(
@@ -37,5 +38,6 @@
}
} // 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,6 +14,7 @@
namespace clang {
namespace tidy {
+namespace google {
namespace build {
/// \brief Finds using namespace directives.
@@ -29,6 +30,7 @@
};
} // 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 {
@@ -67,7 +69,7 @@
if (!StringRef(Filename).endswith(".cpp")) {
Args.emplace_back("-xc++-header");
}
- test::runCheckOnCode<readability::GlobalNamesInHeadersCheck>(
+ test::runCheckOnCode<GlobalNamesInHeadersCheck>(
Header + Code, &Errors, Filename, Args);
if (Errors.empty())
return false;
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits