[clang-tidy] FunctionSizeCheck: wrap FunctionASTVisitor into anon namespace, NFC

This check is relatively simple, and is often being used
as an example. I'm aware of at least two cases, when
simply copying the FunctionASTVisitor class to a new
check resulted in a rather unobvious segfault. Having it
in anonymous namespace prevents such a problem.

No functionality change, so i opted to avoid phabricator,
especially since clang-tidy reviews are seriously jammed.

llvm-svn: 312912
This commit is contained in:
Roman Lebedev 2017-09-11 13:12:31 +00:00
parent c6ea4deb6d
commit 728284dc39

View File

@ -16,6 +16,7 @@ using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace readability {
namespace {
class FunctionASTVisitor : public RecursiveASTVisitor<FunctionASTVisitor> {
using Base = RecursiveASTVisitor<FunctionASTVisitor>;
@ -85,6 +86,8 @@ public:
unsigned CurrentNestingLevel = 0;
};
} // namespace
FunctionSizeCheck::FunctionSizeCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context),
LineThreshold(Options.get("LineThreshold", -1U)),