Index: clang-tidy/cert/CERTTidyModule.cpp =================================================================== --- clang-tidy/cert/CERTTidyModule.cpp +++ clang-tidy/cert/CERTTidyModule.cpp @@ -40,7 +40,7 @@ CheckFactories.registerCheck( "cert-dcl59-cpp"); // OOP - CheckFactories.registerCheck( + CheckFactories.registerCheck( "cert-oop11-cpp"); // ERR CheckFactories.registerCheck( @@ -49,12 +49,12 @@ "cert-err58-cpp"); CheckFactories.registerCheck( "cert-err60-cpp"); - CheckFactories.registerCheck( + CheckFactories.registerCheck( "cert-err61-cpp"); // C checkers // DCL - CheckFactories.registerCheck( + CheckFactories.registerCheck( "cert-dcl03-c"); // ENV CheckFactories.registerCheck( @@ -63,7 +63,7 @@ CheckFactories.registerCheck( "cert-flp30-c"); // FIO - CheckFactories.registerCheck( + CheckFactories.registerCheck( "cert-fio38-c"); // ERR CheckFactories.registerCheck( Index: clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.h =================================================================== --- clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.h +++ clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.h @@ -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 @@ void check(const ast_matchers::MatchFinder::MatchResult &Result) override; }; +} // namespace cppcoreguidelines } // namespace tidy } // namespace clang Index: clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp =================================================================== --- clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp +++ clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp @@ -15,6 +15,7 @@ namespace clang { namespace tidy { +namespace cppcoreguidelines { AST_MATCHER_P(CXXForRangeStmt, hasRangeBeginEndStmt, ast_matchers::internal::Matcher, InnerMatcher) { @@ -74,5 +75,6 @@ "an explicit cast instead"); } +} // namespace cppcoreguidelines } // namespace tidy } // namespace clang Index: clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.h =================================================================== --- clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.h +++ clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.h @@ -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 @@ void check(const ast_matchers::MatchFinder::MatchResult &Result) override; }; +} // namespace cppcoreguidelines } // namespace tidy } // namespace clang Index: clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp =================================================================== --- clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp +++ clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp @@ -17,6 +17,7 @@ namespace clang { namespace tidy { +namespace cppcoreguidelines { ProBoundsConstantArrayIndexCheck::ProBoundsConstantArrayIndexCheck( StringRef Name, ClangTidyContext *Context) @@ -128,5 +129,6 @@ } } +} // namespace cppcoreguidelines } // namespace tidy } // namespace clang Index: clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.h =================================================================== --- clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.h +++ clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.h @@ -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 @@ void check(const ast_matchers::MatchFinder::MatchResult &Result) override; }; +} // namespace cppcoreguidelines } // namespace tidy } // namespace clang Index: clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.cpp =================================================================== --- clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.cpp +++ clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.cpp @@ -15,6 +15,7 @@ namespace clang { namespace tidy { +namespace cppcoreguidelines { void ProBoundsPointerArithmeticCheck::registerMatchers(MatchFinder *Finder) { if (!getLangOpts().CPlusPlus) @@ -53,5 +54,6 @@ diag(MatchedExpr->getExprLoc(), "do not use pointer arithmetic"); } +} // namespace cppcoreguidelines } // namespace tidy } // namespace clang Index: clang-tidy/cppcoreguidelines/ProTypeConstCastCheck.h =================================================================== --- clang-tidy/cppcoreguidelines/ProTypeConstCastCheck.h +++ clang-tidy/cppcoreguidelines/ProTypeConstCastCheck.h @@ -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 @@ void check(const ast_matchers::MatchFinder::MatchResult &Result) override; }; +} // namespace cppcoreguidelines } // namespace tidy } // namespace clang Index: clang-tidy/cppcoreguidelines/ProTypeConstCastCheck.cpp =================================================================== --- clang-tidy/cppcoreguidelines/ProTypeConstCastCheck.cpp +++ clang-tidy/cppcoreguidelines/ProTypeConstCastCheck.cpp @@ -15,7 +15,8 @@ namespace clang { namespace tidy { - +namespace cppcoreguidelines { + void ProTypeConstCastCheck::registerMatchers(MatchFinder *Finder) { if (!getLangOpts().CPlusPlus) return; @@ -28,5 +29,6 @@ diag(MatchedCast->getOperatorLoc(), "do not use const_cast"); } +} // namespace cppcoreguidelines } // namespace tidy } // namespace clang Index: clang-tidy/cppcoreguidelines/ProTypeCstyleCastCheck.h =================================================================== --- clang-tidy/cppcoreguidelines/ProTypeCstyleCastCheck.h +++ clang-tidy/cppcoreguidelines/ProTypeCstyleCastCheck.h @@ -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 @@ void check(const ast_matchers::MatchFinder::MatchResult &Result) override; }; +} // namespace cppcoreguidelines } // namespace tidy } // namespace clang Index: clang-tidy/cppcoreguidelines/ProTypeCstyleCastCheck.cpp =================================================================== --- clang-tidy/cppcoreguidelines/ProTypeCstyleCastCheck.cpp +++ clang-tidy/cppcoreguidelines/ProTypeCstyleCastCheck.cpp @@ -16,6 +16,7 @@ namespace clang { namespace tidy { +namespace cppcoreguidelines { static bool needsConstCast(QualType SourceType, QualType DestType) { SourceType = SourceType.getNonReferenceType(); @@ -103,5 +104,6 @@ } } +} // namespace cppcoreguidelines } // namespace tidy } // namespace clang Index: clang-tidy/cppcoreguidelines/ProTypeReinterpretCastCheck.h =================================================================== --- clang-tidy/cppcoreguidelines/ProTypeReinterpretCastCheck.h +++ clang-tidy/cppcoreguidelines/ProTypeReinterpretCastCheck.h @@ -14,6 +14,7 @@ namespace clang { namespace tidy { +namespace cppcoreguidelines { /// Flags all occurrences of reinterpret_cast /// @@ -27,6 +28,7 @@ void check(const ast_matchers::MatchFinder::MatchResult &Result) override; }; +} // namespace cppcoreguidelines } // namespace tidy } // namespace clang Index: clang-tidy/cppcoreguidelines/ProTypeReinterpretCastCheck.cpp =================================================================== --- clang-tidy/cppcoreguidelines/ProTypeReinterpretCastCheck.cpp +++ clang-tidy/cppcoreguidelines/ProTypeReinterpretCastCheck.cpp @@ -15,6 +15,7 @@ namespace clang { namespace tidy { +namespace cppcoreguidelines { void ProTypeReinterpretCastCheck::registerMatchers(MatchFinder *Finder) { if (!getLangOpts().CPlusPlus) @@ -30,5 +31,6 @@ diag(MatchedCast->getOperatorLoc(), "do not use reinterpret_cast"); } +} // namespace cppcoreguidelines } // namespace tidy } // namespace clang Index: clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.h =================================================================== --- clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.h +++ clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.h @@ -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 @@ void check(const ast_matchers::MatchFinder::MatchResult &Result) override; }; +} // namespace cppcoreguidelines } // namespace tidy } // namespace clang Index: clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.cpp =================================================================== --- clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.cpp +++ clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.cpp @@ -15,7 +15,8 @@ namespace clang { namespace tidy { - +namespace cppcoreguidelines { + void ProTypeStaticCastDowncastCheck::registerMatchers(MatchFinder *Finder) { if (!getLangOpts().CPlusPlus) return; @@ -48,5 +49,6 @@ "do not use static_cast to downcast from a base to a derived class"); } +} // namespace cppcoreguidelines } // namespace tidy } // namespace clang Index: clang-tidy/cppcoreguidelines/ProTypeUnionAccessCheck.h =================================================================== --- clang-tidy/cppcoreguidelines/ProTypeUnionAccessCheck.h +++ clang-tidy/cppcoreguidelines/ProTypeUnionAccessCheck.h @@ -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 @@ void check(const ast_matchers::MatchFinder::MatchResult &Result) override; }; +} // namespace cppcoreguidelines } // namespace tidy } // namespace clang Index: clang-tidy/cppcoreguidelines/ProTypeUnionAccessCheck.cpp =================================================================== --- clang-tidy/cppcoreguidelines/ProTypeUnionAccessCheck.cpp +++ clang-tidy/cppcoreguidelines/ProTypeUnionAccessCheck.cpp @@ -15,6 +15,7 @@ namespace clang { namespace tidy { +namespace cppcoreguidelines { void ProTypeUnionAccessCheck::registerMatchers(MatchFinder *Finder) { if (!getLangOpts().CPlusPlus) @@ -28,6 +29,7 @@ diag(Matched->getMemberLoc(), "do not access members of unions; use (boost::)variant instead"); } +} // namespace cppcoreguidelines } // namespace tidy } // namespace clang Index: clang-tidy/cppcoreguidelines/ProTypeVarargCheck.h =================================================================== --- clang-tidy/cppcoreguidelines/ProTypeVarargCheck.h +++ clang-tidy/cppcoreguidelines/ProTypeVarargCheck.h @@ -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 @@ void check(const ast_matchers::MatchFinder::MatchResult &Result) override; }; +} // namespace cppcoreguidelines } // namespace tidy } // namespace clang Index: clang-tidy/cppcoreguidelines/ProTypeVarargCheck.cpp =================================================================== --- clang-tidy/cppcoreguidelines/ProTypeVarargCheck.cpp +++ clang-tidy/cppcoreguidelines/ProTypeVarargCheck.cpp @@ -15,6 +15,7 @@ namespace clang { namespace tidy { +namespace cppcoreguidelines { const internal::VariadicDynCastAllOfMatcher vAArgExpr; @@ -72,5 +73,6 @@ } } +} // namespace cppcoreguidelines } // namespace tidy } // namespace clang Index: clang-tidy/misc/AssertSideEffectCheck.h =================================================================== --- clang-tidy/misc/AssertSideEffectCheck.h +++ clang-tidy/misc/AssertSideEffectCheck.h @@ -17,6 +17,7 @@ namespace clang { namespace tidy { +namespace misc { /// Finds `assert()` with side effect. /// @@ -44,6 +45,7 @@ SmallVector AssertMacros; }; +} // namespace misc } // namespace tidy } // namespace clang Index: clang-tidy/misc/AssertSideEffectCheck.cpp =================================================================== --- clang-tidy/misc/AssertSideEffectCheck.cpp +++ clang-tidy/misc/AssertSideEffectCheck.cpp @@ -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 @@ } // namespace -namespace tidy { - AssertSideEffectCheck::AssertSideEffectCheck(StringRef Name, ClangTidyContext *Context) : ClangTidyCheck(Name, Context), @@ -121,5 +122,6 @@ diag(Loc, "found %0() with side effect") << AssertMacroName; } +} // namespace misc } // namespace tidy } // namespace clang Index: clang-tidy/misc/BoolPointerImplicitConversionCheck.cpp =================================================================== --- clang-tidy/misc/BoolPointerImplicitConversionCheck.cpp +++ clang-tidy/misc/BoolPointerImplicitConversionCheck.cpp @@ -12,6 +12,9 @@ using namespace clang::ast_matchers; namespace clang { +namespace tidy { +namespace misc { + namespace { AST_MATCHER(CastExpr, isPointerToBoolean) { @@ -20,9 +23,6 @@ } // 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. Index: clang-tidy/misc/IncorrectRoundings.cpp =================================================================== --- clang-tidy/misc/IncorrectRoundings.cpp +++ clang-tidy/misc/IncorrectRoundings.cpp @@ -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 @@ 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()); Index: clang-tidy/misc/MacroParenthesesCheck.h =================================================================== --- clang-tidy/misc/MacroParenthesesCheck.h +++ clang-tidy/misc/MacroParenthesesCheck.h @@ -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 @@ void registerPPCallbacks(CompilerInstance &Compiler) override; }; +} // namespace misc } // namespace tidy } // namespace clang Index: clang-tidy/misc/MacroParenthesesCheck.cpp =================================================================== --- clang-tidy/misc/MacroParenthesesCheck.cpp +++ clang-tidy/misc/MacroParenthesesCheck.cpp @@ -14,6 +14,7 @@ namespace clang { namespace tidy { +namespace misc { namespace { class MacroParenthesesPPCallbacks : public PPCallbacks { @@ -198,5 +199,6 @@ &Compiler.getPreprocessor(), this)); } +} // namespace misc } // namespace tidy } // namespace clang Index: clang-tidy/misc/MoveConstantArgumentCheck.cpp =================================================================== --- clang-tidy/misc/MoveConstantArgumentCheck.cpp +++ clang-tidy/misc/MoveConstantArgumentCheck.cpp @@ -9,14 +9,14 @@ #include "MoveConstantArgumentCheck.h" -#include +#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; Index: clang-tidy/misc/MoveConstructorInitCheck.h =================================================================== --- clang-tidy/misc/MoveConstructorInitCheck.h +++ clang-tidy/misc/MoveConstructorInitCheck.h @@ -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 @@ const bool UseCERTSemantics; }; +} // namespace misc } // namespace tidy } // namespace clang Index: clang-tidy/misc/MoveConstructorInitCheck.cpp =================================================================== --- clang-tidy/misc/MoveConstructorInitCheck.cpp +++ clang-tidy/misc/MoveConstructorInitCheck.cpp @@ -19,6 +19,7 @@ namespace clang { namespace tidy { +namespace misc { namespace { @@ -175,5 +176,6 @@ Options.store(Opts, "IncludeStyle", IncludeSorter::toString(IncludeStyle)); } +} // namespace misc } // namespace tidy } // namespace clang Index: clang-tidy/misc/NewDeleteOverloadsCheck.cpp =================================================================== --- clang-tidy/misc/NewDeleteOverloadsCheck.cpp +++ clang-tidy/misc/NewDeleteOverloadsCheck.cpp @@ -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 @@ return true; } -} // namespace -namespace tidy { -namespace misc { - -namespace { OverloadedOperatorKind getCorrespondingOverload(const FunctionDecl *FD) { switch (FD->getOverloadedOperator()) { default: break; @@ -125,6 +124,7 @@ return false; } + } // anonymous namespace void NewDeleteOverloadsCheck::registerMatchers(MatchFinder *Finder) { Index: clang-tidy/misc/NoexceptMoveConstructorCheck.h =================================================================== --- clang-tidy/misc/NoexceptMoveConstructorCheck.h +++ clang-tidy/misc/NoexceptMoveConstructorCheck.h @@ -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 @@ void check(const ast_matchers::MatchFinder::MatchResult &Result) override; }; +} // namespace misc } // namespace tidy } // namespace clang Index: clang-tidy/misc/NoexceptMoveConstructorCheck.cpp =================================================================== --- clang-tidy/misc/NoexceptMoveConstructorCheck.cpp +++ clang-tidy/misc/NoexceptMoveConstructorCheck.cpp @@ -15,6 +15,7 @@ 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 @@ } } +} // namespace misc } // namespace tidy } // namespace clang Index: clang-tidy/misc/NonCopyableObjects.h =================================================================== --- clang-tidy/misc/NonCopyableObjects.h +++ clang-tidy/misc/NonCopyableObjects.h @@ -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 @@ void check(const ast_matchers::MatchFinder::MatchResult &Result) override; }; +} // namespace misc } // namespace tidy } // namespace clang Index: clang-tidy/misc/NonCopyableObjects.cpp =================================================================== --- clang-tidy/misc/NonCopyableObjects.cpp +++ clang-tidy/misc/NonCopyableObjects.cpp @@ -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 @@ } } // 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 @@ << BD; } +} // namespace misc } // namespace tidy } // namespace clang Index: clang-tidy/misc/SizeofContainerCheck.h =================================================================== --- clang-tidy/misc/SizeofContainerCheck.h +++ clang-tidy/misc/SizeofContainerCheck.h @@ -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 @@ void check(const ast_matchers::MatchFinder::MatchResult &Result) override; }; +} // namespace misc } // namespace tidy } // namespace clang Index: clang-tidy/misc/SizeofContainerCheck.cpp =================================================================== --- clang-tidy/misc/SizeofContainerCheck.cpp +++ clang-tidy/misc/SizeofContainerCheck.cpp @@ -15,6 +15,7 @@ namespace clang { namespace tidy { +namespace misc { void SizeofContainerCheck::registerMatchers(MatchFinder *Finder) { Finder->addMatcher( @@ -43,6 +44,7 @@ "container; did you mean .size()?"); } +} // namespace misc } // namespace tidy } // namespace clang Index: clang-tidy/misc/StaticAssertCheck.h =================================================================== --- clang-tidy/misc/StaticAssertCheck.h +++ clang-tidy/misc/StaticAssertCheck.h @@ -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 @@ SourceLocation AssertLoc); }; +} // namespace misc } // namespace tidy } // namespace clang Index: clang-tidy/misc/StaticAssertCheck.cpp =================================================================== --- clang-tidy/misc/StaticAssertCheck.cpp +++ clang-tidy/misc/StaticAssertCheck.cpp @@ -22,6 +22,7 @@ namespace clang { namespace tidy { +namespace misc { StaticAssertCheck::StaticAssertCheck(StringRef Name, ClangTidyContext *Context) : ClangTidyCheck(Name, Context) {} @@ -164,5 +165,6 @@ return Token.getLocation(); } +} // namespace misc } // namespace tidy } // namespace clang Index: clang-tidy/misc/StringIntegerAssignmentCheck.h =================================================================== --- clang-tidy/misc/StringIntegerAssignmentCheck.h +++ clang-tidy/misc/StringIntegerAssignmentCheck.h @@ -14,6 +14,7 @@ namespace clang { namespace tidy { +namespace misc { /// Finds instances where an integer is assigned to a string. /// @@ -27,6 +28,7 @@ void check(const ast_matchers::MatchFinder::MatchResult &Result) override; }; +} // namespace misc } // namespace tidy } // namespace clang Index: clang-tidy/misc/StringIntegerAssignmentCheck.cpp =================================================================== --- clang-tidy/misc/StringIntegerAssignmentCheck.cpp +++ clang-tidy/misc/StringIntegerAssignmentCheck.cpp @@ -16,6 +16,7 @@ namespace clang { namespace tidy { +namespace misc { void StringIntegerAssignmentCheck::registerMatchers(MatchFinder *Finder) { if (!getLangOpts().CPlusPlus) @@ -81,5 +82,6 @@ } } +} // namespace misc } // namespace tidy } // namespace clang Index: clang-tidy/misc/ThrowByValueCatchByReferenceCheck.h =================================================================== --- clang-tidy/misc/ThrowByValueCatchByReferenceCheck.h +++ clang-tidy/misc/ThrowByValueCatchByReferenceCheck.h @@ -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 @@ const bool CheckAnonymousTemporaries; }; +} // namespace misc } // namespace tidy } // namespace clang Index: clang-tidy/misc/ThrowByValueCatchByReferenceCheck.cpp =================================================================== --- clang-tidy/misc/ThrowByValueCatchByReferenceCheck.cpp +++ clang-tidy/misc/ThrowByValueCatchByReferenceCheck.cpp @@ -16,6 +16,7 @@ namespace clang { namespace tidy { +namespace misc { ThrowByValueCatchByReferenceCheck::ThrowByValueCatchByReferenceCheck( StringRef Name, ClangTidyContext *Context) @@ -155,5 +156,6 @@ } } +} // namespace misc } // namespace tidy } // namespace clang Index: clang-tidy/misc/UndelegatedConstructor.cpp =================================================================== --- clang-tidy/misc/UndelegatedConstructor.cpp +++ clang-tidy/misc/UndelegatedConstructor.cpp @@ -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 @@ } } // 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, Index: clang-tidy/misc/UnusedAliasDeclsCheck.h =================================================================== --- clang-tidy/misc/UnusedAliasDeclsCheck.h +++ clang-tidy/misc/UnusedAliasDeclsCheck.h @@ -15,6 +15,7 @@ namespace clang { namespace tidy { +namespace misc { /// Finds unused namespace alias declarations. class UnusedAliasDeclsCheck : public ClangTidyCheck { @@ -29,6 +30,7 @@ llvm::DenseMap FoundDecls; }; +} // namespace misc } // namespace tidy } // namespace clang Index: clang-tidy/misc/UnusedAliasDeclsCheck.cpp =================================================================== --- clang-tidy/misc/UnusedAliasDeclsCheck.cpp +++ clang-tidy/misc/UnusedAliasDeclsCheck.cpp @@ -16,6 +16,7 @@ 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 @@ } } +} // namespace misc } // namespace tidy } // namespace clang Index: clang-tidy/misc/UnusedParametersCheck.h =================================================================== --- clang-tidy/misc/UnusedParametersCheck.h +++ clang-tidy/misc/UnusedParametersCheck.h @@ -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 @@ const FunctionDecl *Function, unsigned ParamIndex); }; +} // namespace misc } // namespace tidy } // namespace clang Index: clang-tidy/misc/UnusedParametersCheck.cpp =================================================================== --- clang-tidy/misc/UnusedParametersCheck.cpp +++ clang-tidy/misc/UnusedParametersCheck.cpp @@ -16,6 +16,8 @@ namespace clang { namespace tidy { +namespace misc { + namespace { bool isOverrideMethod(const FunctionDecl *Function) { if (const auto *MD = dyn_cast(Function)) @@ -120,5 +122,6 @@ } } +} // namespace misc } // namespace tidy } // namespace clang Index: clang-tidy/misc/UnusedRAIICheck.cpp =================================================================== --- clang-tidy/misc/UnusedRAIICheck.cpp +++ clang-tidy/misc/UnusedRAIICheck.cpp @@ -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 @@ } } // 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. Index: clang-tidy/modernize/RawStringLiteralCheck.h =================================================================== --- clang-tidy/modernize/RawStringLiteralCheck.h +++ clang-tidy/modernize/RawStringLiteralCheck.h @@ -11,7 +11,6 @@ #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_RAW_STRING_LITERAL_H #include "../ClangTidy.h" -//#include namespace clang { namespace tidy { Index: clang-tidy/modernize/RedundantVoidArgCheck.cpp =================================================================== --- clang-tidy/modernize/RedundantVoidArgCheck.cpp +++ clang-tidy/modernize/RedundantVoidArgCheck.cpp @@ -14,6 +14,8 @@ using namespace clang::ast_matchers; namespace clang { +namespace tidy { +namespace modernize { namespace { @@ -42,9 +44,6 @@ } // namespace -namespace tidy { -namespace modernize { - void RedundantVoidArgCheck::registerMatchers(MatchFinder *Finder) { Finder->addMatcher(functionDecl(parameterCountIs(0), unless(isImplicit()), unless(isExternC())) Index: clang-tidy/performance/ForRangeCopyCheck.cpp =================================================================== --- clang-tidy/performance/ForRangeCopyCheck.cpp +++ clang-tidy/performance/ForRangeCopyCheck.cpp @@ -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)) {} Index: clang-tidy/performance/ImplicitCastInLoopCheck.cpp =================================================================== --- clang-tidy/performance/ImplicitCastInLoopCheck.cpp +++ clang-tidy/performance/ImplicitCastInLoopCheck.cpp @@ -15,10 +15,9 @@ #include "clang/ASTMatchers/ASTMatchers.h" #include "clang/Lex/Lexer.h" -namespace clang { - -using namespace ast_matchers; +using namespace clang::ast_matchers; +namespace clang { namespace tidy { namespace performance { Index: clang-tidy/readability/ImplicitBoolCastCheck.h =================================================================== --- clang-tidy/readability/ImplicitBoolCastCheck.h +++ clang-tidy/readability/ImplicitBoolCastCheck.h @@ -14,6 +14,7 @@ namespace clang { namespace tidy { +namespace readability { /// \brief Checks for use of implicit bool casts in expressions. /// @@ -41,6 +42,7 @@ bool AllowConditionalPointerCasts; }; +} // namespace readability } // namespace tidy } // namespace clang Index: clang-tidy/readability/ImplicitBoolCastCheck.cpp =================================================================== --- clang-tidy/readability/ImplicitBoolCastCheck.cpp +++ clang-tidy/readability/ImplicitBoolCastCheck.cpp @@ -16,6 +16,7 @@ namespace clang { namespace tidy { +namespace readability { namespace { @@ -415,5 +416,6 @@ } } +} // namespace readability } // namespace tidy } // namespace clang Index: clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp =================================================================== --- clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp +++ clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp @@ -15,12 +15,12 @@ #include #include +using namespace clang::ast_matchers; + namespace clang { namespace tidy { namespace readability { -using namespace ast_matchers; - namespace { AST_MATCHER(FunctionDecl, hasOtherDeclarations) { Index: clang-tidy/readability/RedundantStringCStrCheck.cpp =================================================================== --- clang-tidy/readability/RedundantStringCStrCheck.cpp +++ clang-tidy/readability/RedundantStringCStrCheck.cpp @@ -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 @@ } // end namespace -namespace tidy { -namespace readability { - void RedundantStringCStrCheck::registerMatchers( ast_matchers::MatchFinder *Finder) { // Only register the matchers for C++; the functionality currently does not Index: clang-tidy/readability/UniqueptrDeleteReleaseCheck.h =================================================================== --- clang-tidy/readability/UniqueptrDeleteReleaseCheck.h +++ clang-tidy/readability/UniqueptrDeleteReleaseCheck.h @@ -14,6 +14,7 @@ namespace clang { namespace tidy { +namespace readability { /// Flag statements of the form: delete .release() /// and replace them with: = nullptr @@ -28,6 +29,7 @@ void check(const ast_matchers::MatchFinder::MatchResult &Result) override; }; +} // namespace readability } // namespace tidy } // namespace clang Index: clang-tidy/readability/UniqueptrDeleteReleaseCheck.cpp =================================================================== --- clang-tidy/readability/UniqueptrDeleteReleaseCheck.cpp +++ clang-tidy/readability/UniqueptrDeleteReleaseCheck.cpp @@ -16,6 +16,7 @@ namespace clang { namespace tidy { +namespace readability { void UniqueptrDeleteReleaseCheck::registerMatchers(MatchFinder *Finder) { auto IsSusbstituted = qualType(anyOf( @@ -64,6 +65,7 @@ " = nullptr"); } +} // namespace readability } // namespace tidy } // namespace clang