diff options
Diffstat (limited to 'clang-tools-extra')
6 files changed, 11 insertions, 13 deletions
diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeConstCastCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeConstCastCheck.cpp index 37aa04e605b..6b32ad04a3f 100644 --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeConstCastCheck.cpp +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeConstCastCheck.cpp @@ -17,7 +17,7 @@ namespace clang { namespace tidy { void ProTypeConstCastCheck::registerMatchers(MatchFinder *Finder) { - if(!getLangOpts().CPlusPlus) + if (!getLangOpts().CPlusPlus) return; Finder->addMatcher(cxxConstCastExpr().bind("cast"), this); @@ -30,4 +30,3 @@ void ProTypeConstCastCheck::check(const MatchFinder::MatchResult &Result) { } // 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 1515797acc1..af7c5547c23 100644 --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeConstCastCheck.h +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeConstCastCheck.h @@ -31,4 +31,3 @@ public: } // namespace clang #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CPPCOREGUIDELINES_PRO_TYPE_CONST_CAST_H - diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeReinterpretCastCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeReinterpretCastCheck.cpp index db858836f58..57c4a59b8f6 100644 --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeReinterpretCastCheck.cpp +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeReinterpretCastCheck.cpp @@ -1,4 +1,4 @@ -//===--- ProTypeReinterpretCastCheck.cpp - clang-tidy--------------------------===// +//===--- ProTypeReinterpretCastCheck.cpp - clang-tidy----------------------===// // // The LLVM Compiler Infrastructure // @@ -23,11 +23,11 @@ void ProTypeReinterpretCastCheck::registerMatchers(MatchFinder *Finder) { Finder->addMatcher(cxxReinterpretCastExpr().bind("cast"), this); } -void ProTypeReinterpretCastCheck::check(const MatchFinder::MatchResult &Result) { +void ProTypeReinterpretCastCheck::check( + const MatchFinder::MatchResult &Result) { const auto *MatchedCast = Result.Nodes.getNodeAs<CXXReinterpretCastExpr>("cast"); - diag(MatchedCast->getOperatorLoc(), - "do not use reinterpret_cast"); + diag(MatchedCast->getOperatorLoc(), "do not use reinterpret_cast"); } } // namespace tidy diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeReinterpretCastCheck.h b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeReinterpretCastCheck.h index e59fcf99018..0ca16e54112 100644 --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeReinterpretCastCheck.h +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeReinterpretCastCheck.h @@ -18,7 +18,7 @@ namespace tidy { /// Flags all occurrences of reinterpret_cast /// /// For the user-facing documentation see: -/// http://clang.llvm.org/extra/clang-tidy/checks/misc-no-reinterpret-cast.html +/// http://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines-pro-type-reinterpret-cast.html class ProTypeReinterpretCastCheck : public ClangTidyCheck { public: ProTypeReinterpretCastCheck(StringRef Name, ClangTidyContext *Context) diff --git a/clang-tools-extra/test/clang-tidy/cppcoreguidelines-pro-type-const-cast.cpp b/clang-tools-extra/test/clang-tidy/cppcoreguidelines-pro-type-const-cast.cpp index 6dd250b3ec2..6221c049f64 100644 --- a/clang-tools-extra/test/clang-tidy/cppcoreguidelines-pro-type-const-cast.cpp +++ b/clang-tools-extra/test/clang-tidy/cppcoreguidelines-pro-type-const-cast.cpp @@ -1,6 +1,6 @@ // RUN: %python %S/check_clang_tidy.py %s cppcoreguidelines-pro-type-const-cast %t -const int* i; -int* j; -void f() { j = const_cast<int*>(i); } +const int *i; +int *j; +void f() { j = const_cast<int *>(i); } // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: do not use const_cast [cppcoreguidelines-pro-type-const-cast] diff --git a/clang-tools-extra/test/clang-tidy/cppcoreguidelines-pro-type-reinterpret-cast.cpp b/clang-tools-extra/test/clang-tidy/cppcoreguidelines-pro-type-reinterpret-cast.cpp index 03b64dd0011..02822325ca0 100644 --- a/clang-tools-extra/test/clang-tidy/cppcoreguidelines-pro-type-reinterpret-cast.cpp +++ b/clang-tools-extra/test/clang-tidy/cppcoreguidelines-pro-type-reinterpret-cast.cpp @@ -1,6 +1,6 @@ // RUN: %python %S/check_clang_tidy.py %s cppcoreguidelines-pro-type-reinterpret-cast %t int i = 0; -void* j; -void f() { j = reinterpret_cast<void*>(i); } +void *j; +void f() { j = reinterpret_cast<void *>(i); } // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: do not use reinterpret_cast [cppcoreguidelines-pro-type-reinterpret-cast] |

