[clang-tidy] Cleaning namespaces to be more consistant across checkers.

Summary:
The goal of the patch is to bring checkers in their appropriate namespace.
This path doesn't change any behavior.

Reviewers: alexfh

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D19811

llvm-svn: 268264
This commit is contained in:
Etienne Bergeron 2016-05-02 18:00:29 +00:00
parent 93529ed9b8
commit 456177b98f
57 changed files with 137 additions and 52 deletions

View File

@ -40,7 +40,7 @@ public:
CheckFactories.registerCheck<google::build::UnnamedNamespaceInHeaderCheck>(
"cert-dcl59-cpp");
// OOP
CheckFactories.registerCheck<MoveConstructorInitCheck>(
CheckFactories.registerCheck<misc::MoveConstructorInitCheck>(
"cert-oop11-cpp");
// ERR
CheckFactories.registerCheck<SetLongJmpCheck>(
@ -49,12 +49,12 @@ public:
"cert-err58-cpp");
CheckFactories.registerCheck<ThrownExceptionTypeCheck>(
"cert-err60-cpp");
CheckFactories.registerCheck<ThrowByValueCatchByReferenceCheck>(
CheckFactories.registerCheck<misc::ThrowByValueCatchByReferenceCheck>(
"cert-err61-cpp");
// C checkers
// DCL
CheckFactories.registerCheck<StaticAssertCheck>(
CheckFactories.registerCheck<misc::StaticAssertCheck>(
"cert-dcl03-c");
// ENV
CheckFactories.registerCheck<CommandProcessorCheck>(
@ -63,7 +63,7 @@ public:
CheckFactories.registerCheck<FloatLoopCounter>(
"cert-flp30-c");
// FIO
CheckFactories.registerCheck<NonCopyableObjectsCheck>(
CheckFactories.registerCheck<misc::NonCopyableObjectsCheck>(
"cert-fio38-c");
// ERR
CheckFactories.registerCheck<StrToNumCheck>(

View File

@ -15,6 +15,7 @@ using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace cppcoreguidelines {
AST_MATCHER_P(CXXForRangeStmt, hasRangeBeginEndStmt,
ast_matchers::internal::Matcher<DeclStmt>, InnerMatcher) {
@ -74,5 +75,6 @@ void ProBoundsArrayToPointerDecayCheck::check(
"an explicit cast instead");
}
} // namespace cppcoreguidelines
} // namespace tidy
} // namespace clang

View File

@ -14,7 +14,8 @@
namespace clang {
namespace tidy {
namespace cppcoreguidelines {
/// This check flags all array to pointer decays
///
/// For the user-facing documentation see:
@ -27,6 +28,7 @@ public:
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};
} // namespace cppcoreguidelines
} // namespace tidy
} // namespace clang

View File

@ -17,6 +17,7 @@ using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace cppcoreguidelines {
ProBoundsConstantArrayIndexCheck::ProBoundsConstantArrayIndexCheck(
StringRef Name, ClangTidyContext *Context)
@ -128,5 +129,6 @@ void ProBoundsConstantArrayIndexCheck::check(
}
}
} // namespace cppcoreguidelines
} // namespace tidy
} // namespace clang

View File

@ -15,6 +15,7 @@
namespace clang {
namespace tidy {
namespace cppcoreguidelines {
/// This checks that all array subscriptions on static arrays and std::arrays
/// have a constant index and are within bounds
@ -34,6 +35,7 @@ public:
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};
} // namespace cppcoreguidelines
} // namespace tidy
} // namespace clang

View File

@ -15,6 +15,7 @@ using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace cppcoreguidelines {
void ProBoundsPointerArithmeticCheck::registerMatchers(MatchFinder *Finder) {
if (!getLangOpts().CPlusPlus)
@ -53,5 +54,6 @@ ProBoundsPointerArithmeticCheck::check(const MatchFinder::MatchResult &Result) {
diag(MatchedExpr->getExprLoc(), "do not use pointer arithmetic");
}
} // namespace cppcoreguidelines
} // namespace tidy
} // namespace clang

View File

@ -14,6 +14,7 @@
namespace clang {
namespace tidy {
namespace cppcoreguidelines {
/// Flags all kinds of pointer arithmetic that have result of pointer type, i.e.
/// +, -, +=, -=, ++, --. In addition, the [] operator on pointers (not on arrays) is flagged.
@ -28,6 +29,7 @@ public:
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};
} // namespace cppcoreguidelines
} // namespace tidy
} // namespace clang

View File

@ -15,7 +15,8 @@ using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace cppcoreguidelines {
void ProTypeConstCastCheck::registerMatchers(MatchFinder *Finder) {
if (!getLangOpts().CPlusPlus)
return;
@ -28,5 +29,6 @@ void ProTypeConstCastCheck::check(const MatchFinder::MatchResult &Result) {
diag(MatchedCast->getOperatorLoc(), "do not use const_cast");
}
} // namespace cppcoreguidelines
} // namespace tidy
} // namespace clang

View File

@ -14,7 +14,8 @@
namespace clang {
namespace tidy {
namespace cppcoreguidelines {
/// This check flags all instances of const_cast
///
/// For the user-facing documentation see:
@ -27,6 +28,7 @@ public:
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};
} // namespace cppcoreguidelines
} // namespace tidy
} // namespace clang

View File

@ -16,6 +16,7 @@ using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace cppcoreguidelines {
static bool needsConstCast(QualType SourceType, QualType DestType) {
SourceType = SourceType.getNonReferenceType();
@ -103,5 +104,6 @@ void ProTypeCstyleCastCheck::check(const MatchFinder::MatchResult &Result) {
}
}
} // namespace cppcoreguidelines
} // namespace tidy
} // namespace clang

View File

@ -14,6 +14,7 @@
namespace clang {
namespace tidy {
namespace cppcoreguidelines {
/// This check flags all use of C-style casts that perform a static_cast
/// downcast, const_cast, or reinterpret_cast.
@ -28,6 +29,7 @@ public:
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};
} // namespace cppcoreguidelines
} // namespace tidy
} // namespace clang

View File

@ -15,6 +15,7 @@ using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace cppcoreguidelines {
void ProTypeReinterpretCastCheck::registerMatchers(MatchFinder *Finder) {
if (!getLangOpts().CPlusPlus)
@ -30,5 +31,6 @@ void ProTypeReinterpretCastCheck::check(
diag(MatchedCast->getOperatorLoc(), "do not use reinterpret_cast");
}
} // namespace cppcoreguidelines
} // namespace tidy
} // namespace clang

View File

@ -14,6 +14,7 @@
namespace clang {
namespace tidy {
namespace cppcoreguidelines {
/// Flags all occurrences of reinterpret_cast
///
@ -27,6 +28,7 @@ public:
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};
} // namespace cppcoreguidelines
} // namespace tidy
} // namespace clang

View File

@ -15,7 +15,8 @@ using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace cppcoreguidelines {
void ProTypeStaticCastDowncastCheck::registerMatchers(MatchFinder *Finder) {
if (!getLangOpts().CPlusPlus)
return;
@ -48,5 +49,6 @@ void ProTypeStaticCastDowncastCheck::check(const MatchFinder::MatchResult &Resul
"do not use static_cast to downcast from a base to a derived class");
}
} // namespace cppcoreguidelines
} // namespace tidy
} // namespace clang

View File

@ -14,7 +14,8 @@
namespace clang {
namespace tidy {
namespace cppcoreguidelines {
/// Checks for usages of static_cast, where a base class is downcasted to a derived class.
///
/// For the user-facing documentation see:
@ -27,6 +28,7 @@ public:
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};
} // namespace cppcoreguidelines
} // namespace tidy
} // namespace clang

View File

@ -15,6 +15,7 @@ using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace cppcoreguidelines {
void ProTypeUnionAccessCheck::registerMatchers(MatchFinder *Finder) {
if (!getLangOpts().CPlusPlus)
@ -28,6 +29,7 @@ void ProTypeUnionAccessCheck::check(const MatchFinder::MatchResult &Result) {
diag(Matched->getMemberLoc(), "do not access members of unions; use (boost::)variant instead");
}
} // namespace cppcoreguidelines
} // namespace tidy
} // namespace clang

View File

@ -14,6 +14,7 @@
namespace clang {
namespace tidy {
namespace cppcoreguidelines {
/// This check flags all access to members of unions.
/// Access to a union as a whole (e.g. passing to a function) is not flagged.
@ -28,6 +29,7 @@ public:
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};
} // namespace cppcoreguidelines
} // namespace tidy
} // namespace clang

View File

@ -15,6 +15,7 @@ using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace cppcoreguidelines {
const internal::VariadicDynCastAllOfMatcher<Stmt, VAArgExpr> vAArgExpr;
@ -72,5 +73,6 @@ void ProTypeVarargCheck::check(const MatchFinder::MatchResult &Result) {
}
}
} // namespace cppcoreguidelines
} // namespace tidy
} // namespace clang

View File

@ -14,6 +14,7 @@
namespace clang {
namespace tidy {
namespace cppcoreguidelines {
/// This check flags all calls to c-style variadic functions and all use
/// of va_arg.
@ -28,6 +29,7 @@ public:
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};
} // namespace cppcoreguidelines
} // namespace tidy
} // namespace clang

View File

@ -21,6 +21,9 @@
using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace misc {
namespace {
AST_MATCHER_P(Expr, hasSideEffect, bool, CheckFunctionCalls) {
@ -66,8 +69,6 @@ AST_MATCHER_P(Expr, hasSideEffect, bool, CheckFunctionCalls) {
} // namespace
namespace tidy {
AssertSideEffectCheck::AssertSideEffectCheck(StringRef Name,
ClangTidyContext *Context)
: ClangTidyCheck(Name, Context),
@ -121,5 +122,6 @@ void AssertSideEffectCheck::check(const MatchFinder::MatchResult &Result) {
diag(Loc, "found %0() with side effect") << AssertMacroName;
}
} // namespace misc
} // namespace tidy
} // namespace clang

View File

@ -17,6 +17,7 @@
namespace clang {
namespace tidy {
namespace misc {
/// Finds `assert()` with side effect.
///
@ -44,6 +45,7 @@ private:
SmallVector<StringRef, 5> AssertMacros;
};
} // namespace misc
} // namespace tidy
} // namespace clang

View File

@ -12,6 +12,9 @@
using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace misc {
namespace {
AST_MATCHER(CastExpr, isPointerToBoolean) {
@ -20,9 +23,6 @@ AST_MATCHER(CastExpr, isPointerToBoolean) {
} // namespace
namespace tidy {
namespace misc {
void BoolPointerImplicitConversionCheck::registerMatchers(MatchFinder *Finder) {
// Look for ifs that have an implicit bool* to bool conversion in the
// condition. Filter negations.

View File

@ -14,8 +14,13 @@
#include "clang/ASTMatchers/ASTMatchers.h"
#include "clang/Lex/Lexer.h"
using namespace clang::ast_matchers;
namespace clang {
namespace ast_matchers {
namespace tidy {
namespace misc {
namespace {
AST_MATCHER(FloatingLiteral, floatHalf) {
const auto &literal = Node.getValue();
if ((&Node.getSemantics()) == &llvm::APFloat::IEEEsingle)
@ -24,14 +29,9 @@ AST_MATCHER(FloatingLiteral, floatHalf) {
return literal.convertToDouble() == 0.5;
return false;
}
} // namespace ast_matchers
} // namespace clang
} // namespace
using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace misc {
void IncorrectRoundings::registerMatchers(MatchFinder *MatchFinder) {
// Match a floating literal with value 0.5.
auto FloatHalf = floatLiteral(floatHalf());

View File

@ -14,6 +14,7 @@
namespace clang {
namespace tidy {
namespace misc {
namespace {
class MacroParenthesesPPCallbacks : public PPCallbacks {
@ -198,5 +199,6 @@ void MacroParenthesesCheck::registerPPCallbacks(CompilerInstance &Compiler) {
&Compiler.getPreprocessor(), this));
}
} // namespace misc
} // namespace tidy
} // namespace clang

View File

@ -14,6 +14,7 @@
namespace clang {
namespace tidy {
namespace misc {
/// Finds macros that can have unexpected behaviour due to missing parentheses.
///
@ -35,6 +36,7 @@ public:
void registerPPCallbacks(CompilerInstance &Compiler) override;
};
} // namespace misc
} // namespace tidy
} // namespace clang

View File

@ -9,14 +9,14 @@
#include "MoveConstantArgumentCheck.h"
#include <clang/Lex/Lexer.h>
#include "clang/Lex/Lexer.h"
using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace misc {
using namespace ast_matchers;
void MoveConstantArgumentCheck::registerMatchers(MatchFinder *Finder) {
if (!getLangOpts().CPlusPlus)
return;

View File

@ -19,6 +19,7 @@ using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace misc {
namespace {
@ -175,5 +176,6 @@ void MoveConstructorInitCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
Options.store(Opts, "IncludeStyle", IncludeSorter::toString(IncludeStyle));
}
} // namespace misc
} // namespace tidy
} // namespace clang

View File

@ -17,6 +17,7 @@
namespace clang {
namespace tidy {
namespace misc {
/// The check flags user-defined move constructors that have a ctor-initializer
/// initializing a member or base class through a copy constructor instead of a
@ -42,6 +43,7 @@ private:
const bool UseCERTSemantics;
};
} // namespace misc
} // namespace tidy
} // namespace clang

View File

@ -14,7 +14,11 @@
using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace misc {
namespace {
AST_MATCHER(FunctionDecl, isPlacementOverload) {
bool New;
switch (Node.getOverloadedOperator()) {
@ -57,12 +61,7 @@ AST_MATCHER(FunctionDecl, isPlacementOverload) {
return true;
}
} // namespace
namespace tidy {
namespace misc {
namespace {
OverloadedOperatorKind getCorrespondingOverload(const FunctionDecl *FD) {
switch (FD->getOverloadedOperator()) {
default: break;
@ -125,6 +124,7 @@ bool hasCorrespondingOverloadInBaseClass(const CXXMethodDecl *MD,
return false;
}
} // anonymous namespace
void NewDeleteOverloadsCheck::registerMatchers(MatchFinder *Finder) {

View File

@ -15,6 +15,7 @@ using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace misc {
void NoexceptMoveConstructorCheck::registerMatchers(MatchFinder *Finder) {
// Only register the matchers for C++11; the functionality currently does not
@ -67,6 +68,7 @@ void NoexceptMoveConstructorCheck::check(
}
}
} // namespace misc
} // namespace tidy
} // namespace clang

View File

@ -14,6 +14,7 @@
namespace clang {
namespace tidy {
namespace misc {
/// The check flags user-defined move constructors and assignment operators not
/// marked with `noexcept` or marked with `noexcept(expr)` where `expr`
@ -30,6 +31,7 @@ public:
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};
} // namespace misc
} // namespace tidy
} // namespace clang

View File

@ -15,6 +15,9 @@
using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace misc {
namespace {
// FIXME: it would be good to make a list that is also user-configurable so that
// users can add their own elements to the list. However, it may require some
@ -49,7 +52,6 @@ AST_MATCHER(NamedDecl, isPOSIXType) {
}
} // namespace
namespace tidy {
void NonCopyableObjectsCheck::registerMatchers(MatchFinder *Finder) {
// There are two ways to get into trouble with objects like FILE *:
// dereferencing the pointer type to be a non-pointer type, and declaring
@ -91,6 +93,7 @@ void NonCopyableObjectsCheck::check(const MatchFinder::MatchResult &Result) {
<< BD;
}
} // namespace misc
} // namespace tidy
} // namespace clang

View File

@ -14,6 +14,7 @@
namespace clang {
namespace tidy {
namespace misc {
/// The check flags dereferences and non-pointer declarations of objects that
/// are not meant to be passed by value, such as C FILE objects.
@ -25,6 +26,7 @@ public:
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};
} // namespace misc
} // namespace tidy
} // namespace clang

View File

@ -15,6 +15,7 @@ using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace misc {
void SizeofContainerCheck::registerMatchers(MatchFinder *Finder) {
Finder->addMatcher(
@ -43,6 +44,7 @@ void SizeofContainerCheck::check(const MatchFinder::MatchResult &Result) {
"container; did you mean .size()?");
}
} // namespace misc
} // namespace tidy
} // namespace clang

View File

@ -14,6 +14,7 @@
namespace clang {
namespace tidy {
namespace misc {
/// Find usages of sizeof on expressions of STL container types. Most likely the
/// user wanted to use `.size()` instead.
@ -28,6 +29,7 @@ public:
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};
} // namespace misc
} // namespace tidy
} // namespace clang

View File

@ -22,6 +22,7 @@ using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace misc {
StaticAssertCheck::StaticAssertCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context) {}
@ -164,5 +165,6 @@ SourceLocation StaticAssertCheck::getLastParenLoc(const ASTContext *ASTCtx,
return Token.getLocation();
}
} // namespace misc
} // namespace tidy
} // namespace clang

View File

@ -16,6 +16,7 @@
namespace clang {
namespace tidy {
namespace misc {
/// Replaces `assert()` with `static_assert()` if the condition is evaluatable
/// at compile time.
@ -33,6 +34,7 @@ private:
SourceLocation AssertLoc);
};
} // namespace misc
} // namespace tidy
} // namespace clang

View File

@ -16,6 +16,7 @@ using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace misc {
void StringIntegerAssignmentCheck::registerMatchers(MatchFinder *Finder) {
if (!getLangOpts().CPlusPlus)
@ -81,5 +82,6 @@ void StringIntegerAssignmentCheck::check(
}
}
} // namespace misc
} // namespace tidy
} // namespace clang

View File

@ -14,6 +14,7 @@
namespace clang {
namespace tidy {
namespace misc {
/// Finds instances where an integer is assigned to a string.
///
@ -27,6 +28,7 @@ public:
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};
} // namespace misc
} // namespace tidy
} // namespace clang

View File

@ -16,6 +16,7 @@ using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace misc {
ThrowByValueCatchByReferenceCheck::ThrowByValueCatchByReferenceCheck(
StringRef Name, ClangTidyContext *Context)
@ -155,5 +156,6 @@ void ThrowByValueCatchByReferenceCheck::diagnoseCatchLocations(
}
}
} // namespace misc
} // namespace tidy
} // namespace clang

View File

@ -14,6 +14,7 @@
namespace clang {
namespace tidy {
namespace misc {
///\brief checks for locations that do not throw by value
// or catch by reference.
@ -43,6 +44,7 @@ private:
const bool CheckAnonymousTemporaries;
};
} // namespace misc
} // namespace tidy
} // namespace clang

View File

@ -14,6 +14,8 @@
using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace misc {
namespace {
AST_MATCHER_P(Stmt, ignoringTemporaryExpr,
@ -46,9 +48,6 @@ AST_MATCHER_P(CXXRecordDecl, baseOfBoundNode, std::string, ID) {
}
} // namespace
namespace tidy {
namespace misc {
void UndelegatedConstructorCheck::registerMatchers(MatchFinder *Finder) {
// We look for calls to constructors of the same type in constructors. To do
// this we have to look through a variety of nodes that occur in the path,

View File

@ -16,6 +16,7 @@ using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace misc {
void UnusedAliasDeclsCheck::registerMatchers(MatchFinder *Finder) {
// Only register the matchers for C++11; the functionality currently does not
@ -58,5 +59,6 @@ void UnusedAliasDeclsCheck::onEndOfTranslationUnit() {
}
}
} // namespace misc
} // namespace tidy
} // namespace clang

View File

@ -15,6 +15,7 @@
namespace clang {
namespace tidy {
namespace misc {
/// Finds unused namespace alias declarations.
class UnusedAliasDeclsCheck : public ClangTidyCheck {
@ -29,6 +30,7 @@ private:
llvm::DenseMap<const NamedDecl *, CharSourceRange> FoundDecls;
};
} // namespace misc
} // namespace tidy
} // namespace clang

View File

@ -16,6 +16,8 @@ using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace misc {
namespace {
bool isOverrideMethod(const FunctionDecl *Function) {
if (const auto *MD = dyn_cast<CXXMethodDecl>(Function))
@ -120,5 +122,6 @@ void UnusedParametersCheck::check(const MatchFinder::MatchResult &Result) {
}
}
} // namespace misc
} // namespace tidy
} // namespace clang

View File

@ -14,6 +14,7 @@
namespace clang {
namespace tidy {
namespace misc {
/// Finds unused parameters and fixes them, so that `-Wunused-parameter` can be
/// turned on.
@ -30,6 +31,7 @@ private:
const FunctionDecl *Function, unsigned ParamIndex);
};
} // namespace misc
} // namespace tidy
} // namespace clang

View File

@ -14,6 +14,9 @@
using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace misc {
namespace {
AST_MATCHER(CXXRecordDecl, hasNonTrivialDestructor) {
// TODO: If the dtor is there but empty we don't want to warn either.
@ -21,9 +24,6 @@ AST_MATCHER(CXXRecordDecl, hasNonTrivialDestructor) {
}
} // namespace
namespace tidy {
namespace misc {
void UnusedRAIICheck::registerMatchers(MatchFinder *Finder) {
// Only register the matchers for C++; the functionality currently does not
// provide any benefit to other languages, despite being benign.

View File

@ -11,7 +11,6 @@
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_RAW_STRING_LITERAL_H
#include "../ClangTidy.h"
//#include <string>
namespace clang {
namespace tidy {

View File

@ -14,6 +14,8 @@
using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace modernize {
namespace {
@ -42,9 +44,6 @@ const char LambdaId[] = "lambda";
} // namespace
namespace tidy {
namespace modernize {
void RedundantVoidArgCheck::registerMatchers(MatchFinder *Finder) {
Finder->addMatcher(functionDecl(parameterCountIs(0), unless(isImplicit()),
unless(isExternC()))

View File

@ -12,12 +12,12 @@
#include "../utils/FixItHintUtils.h"
#include "../utils/TypeTraits.h"
using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace performance {
using namespace ::clang::ast_matchers;
ForRangeCopyCheck::ForRangeCopyCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context),
WarnOnAllAutoCopies(Options.get("WarnOnAllAutoCopies", 0)) {}

View File

@ -15,10 +15,9 @@
#include "clang/ASTMatchers/ASTMatchers.h"
#include "clang/Lex/Lexer.h"
using namespace clang::ast_matchers;
namespace clang {
using namespace ast_matchers;
namespace tidy {
namespace performance {

View File

@ -16,6 +16,7 @@ using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace readability {
namespace {
@ -415,5 +416,6 @@ void ImplicitBoolCastCheck::handleCastFromBool(
}
}
} // namespace readability
} // namespace tidy
} // namespace clang

View File

@ -14,6 +14,7 @@
namespace clang {
namespace tidy {
namespace readability {
/// \brief Checks for use of implicit bool casts in expressions.
///
@ -41,6 +42,7 @@ private:
bool AllowConditionalPointerCasts;
};
} // namespace readability
} // namespace tidy
} // namespace clang

View File

@ -15,12 +15,12 @@
#include <functional>
#include <sstream>
using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace readability {
using namespace ast_matchers;
namespace {
AST_MATCHER(FunctionDecl, hasOtherDeclarations) {

View File

@ -14,9 +14,11 @@
#include "RedundantStringCStrCheck.h"
#include "clang/Lex/Lexer.h"
namespace clang {
using namespace clang::ast_matchers;
using namespace ast_matchers;
namespace clang {
namespace tidy {
namespace readability {
namespace {
@ -67,9 +69,6 @@ formatDereference(const ast_matchers::MatchFinder::MatchResult &Result,
} // end namespace
namespace tidy {
namespace readability {
void RedundantStringCStrCheck::registerMatchers(
ast_matchers::MatchFinder *Finder) {
// Only register the matchers for C++; the functionality currently does not

View File

@ -16,6 +16,7 @@ using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace readability {
void UniqueptrDeleteReleaseCheck::registerMatchers(MatchFinder *Finder) {
auto IsSusbstituted = qualType(anyOf(
@ -64,6 +65,7 @@ void UniqueptrDeleteReleaseCheck::check(
" = nullptr");
}
} // namespace readability
} // namespace tidy
} // namespace clang

View File

@ -14,6 +14,7 @@
namespace clang {
namespace tidy {
namespace readability {
/// Flag statements of the form: delete <unique_ptr expr>.release()
/// and replace them with: <unique_ptr expr> = nullptr
@ -28,6 +29,7 @@ public:
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};
} // namespace readability
} // namespace tidy
} // namespace clang