diff options
Diffstat (limited to 'clang-tools-extra/clang-tidy/cppcoreguidelines')
18 files changed, 41 insertions, 5 deletions
diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp index 8a37b1b68fa..bfcef89e6bb 100644 --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp @@ -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 diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.h b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.h index ec6979a5069..b376e64d0d7 100644 --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.h +++ b/clang-tools-extra/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 @@ public: void check(const ast_matchers::MatchFinder::MatchResult &Result) override; }; +} // namespace cppcoreguidelines } // namespace tidy } // namespace clang diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp index a8dc1d87555..30792e7777c 100644 --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp @@ -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 diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.h b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.h index 1caf28cc311..b83475ca419 100644 --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.h +++ b/clang-tools-extra/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 @@ public: void check(const ast_matchers::MatchFinder::MatchResult &Result) override; }; +} // namespace cppcoreguidelines } // namespace tidy } // namespace clang diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.cpp index 9dcd7c4a370..da850931328 100644 --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.cpp +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.cpp @@ -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 diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.h b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.h index f3a3fb18cff..6f330cf1358 100644 --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.h +++ b/clang-tools-extra/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 @@ public: void check(const ast_matchers::MatchFinder::MatchResult &Result) override; }; +} // namespace cppcoreguidelines } // namespace tidy } // namespace clang diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeConstCastCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeConstCastCheck.cpp index 6b32ad04a3f..5331cdacddc 100644 --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeConstCastCheck.cpp +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeConstCastCheck.cpp @@ -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 diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeConstCastCheck.h b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeConstCastCheck.h index af7c5547c23..fda082e1c2b 100644 --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeConstCastCheck.h +++ b/clang-tools-extra/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 @@ public: void check(const ast_matchers::MatchFinder::MatchResult &Result) override; }; +} // namespace cppcoreguidelines } // namespace tidy } // namespace clang diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeCstyleCastCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeCstyleCastCheck.cpp index 542dd854c43..4055423ebc8 100644 --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeCstyleCastCheck.cpp +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeCstyleCastCheck.cpp @@ -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 diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeCstyleCastCheck.h b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeCstyleCastCheck.h index f85be87d93b..c08b883c0ad 100644 --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeCstyleCastCheck.h +++ b/clang-tools-extra/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 @@ public: void check(const ast_matchers::MatchFinder::MatchResult &Result) override; }; +} // namespace cppcoreguidelines } // namespace tidy } // namespace clang diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeReinterpretCastCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeReinterpretCastCheck.cpp index 57c4a59b8f6..e56e6388c67 100644 --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeReinterpretCastCheck.cpp +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeReinterpretCastCheck.cpp @@ -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 diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeReinterpretCastCheck.h b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeReinterpretCastCheck.h index 0ca16e54112..9610546fff3 100644 --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeReinterpretCastCheck.h +++ b/clang-tools-extra/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 @@ public: void check(const ast_matchers::MatchFinder::MatchResult &Result) override; }; +} // namespace cppcoreguidelines } // namespace tidy } // namespace clang diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.cpp index 0033e4ed9d3..002f8f1ed2d 100644 --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.cpp +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.cpp @@ -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 diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.h b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.h index 02de48ae957..d718feca2f8 100644 --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.h +++ b/clang-tools-extra/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 @@ public: void check(const ast_matchers::MatchFinder::MatchResult &Result) override; }; +} // namespace cppcoreguidelines } // namespace tidy } // namespace clang diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeUnionAccessCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeUnionAccessCheck.cpp index 64f51369bd3..5233ad8f4b8 100644 --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeUnionAccessCheck.cpp +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeUnionAccessCheck.cpp @@ -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 diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeUnionAccessCheck.h b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeUnionAccessCheck.h index 67ce6165811..28097faae9e 100644 --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeUnionAccessCheck.h +++ b/clang-tools-extra/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 @@ public: void check(const ast_matchers::MatchFinder::MatchResult &Result) override; }; +} // namespace cppcoreguidelines } // namespace tidy } // namespace clang diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeVarargCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeVarargCheck.cpp index 526016eadd9..680037f9998 100644 --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeVarargCheck.cpp +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeVarargCheck.cpp @@ -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 diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeVarargCheck.h b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeVarargCheck.h index fd1f9bfe403..558c85680b9 100644 --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeVarargCheck.h +++ b/clang-tools-extra/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 @@ public: void check(const ast_matchers::MatchFinder::MatchResult &Result) override; }; +} // namespace cppcoreguidelines } // namespace tidy } // namespace clang |