summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/google
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/clang-tidy/google')
-rw-r--r--clang-tools-extra/clang-tidy/google/CMakeLists.txt1
-rw-r--r--clang-tools-extra/clang-tidy/google/CStyleCastsCheck.cpp52
-rw-r--r--clang-tools-extra/clang-tidy/google/CStyleCastsCheck.h33
-rw-r--r--clang-tools-extra/clang-tidy/google/GoogleTidyModule.cpp4
4 files changed, 0 insertions, 90 deletions
diff --git a/clang-tools-extra/clang-tidy/google/CMakeLists.txt b/clang-tools-extra/clang-tidy/google/CMakeLists.txt
index 648de8e13ec..3562e520ca8 100644
--- a/clang-tools-extra/clang-tidy/google/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/google/CMakeLists.txt
@@ -1,7 +1,6 @@
set(LLVM_LINK_COMPONENTS support)
add_clang_library(clangTidyGoogleModule
- CStyleCastsCheck.cpp
ExplicitConstructorCheck.cpp
GoogleTidyModule.cpp
diff --git a/clang-tools-extra/clang-tidy/google/CStyleCastsCheck.cpp b/clang-tools-extra/clang-tidy/google/CStyleCastsCheck.cpp
deleted file mode 100644
index c52e0d522bc..00000000000
--- a/clang-tools-extra/clang-tidy/google/CStyleCastsCheck.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-//===--- CStyleCastsCheck.cpp - clang-tidy ----------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "CStyleCastsCheck.h"
-#include "clang/ASTMatchers/ASTMatchFinder.h"
-#include "clang/ASTMatchers/ASTMatchers.h"
-
-using namespace clang::ast_matchers;
-
-namespace clang {
-namespace tidy {
-namespace readability {
-
-void CStyleCastsCheck::registerMatchers(ast_matchers::MatchFinder *Finder) {
- Finder->addMatcher(
- cStyleCastExpr(
- // Filter out (EnumType)IntegerLiteral construct, which is generated
- // for non-type template arguments of enum types.
- // FIXME: Remove this once this is fixed in the AST.
- unless(allOf(hasDestinationType(hasDeclaration(enumDecl())),
- hasSourceExpression(integerLiteral())))).bind("cast"),
- this);
-}
-
-void CStyleCastsCheck::check(const MatchFinder::MatchResult &Result) {
- const auto *CastExpr = Result.Nodes.getNodeAs<CStyleCastExpr>("cast");
-
- // Ignore casts in macros for now.
- if (CastExpr->getLocStart().isMacroID())
- return;
-
- // Casting to void is an idiomatic way to mute "unused variable" and similar
- // warnings.
- if (CastExpr->getTypeAsWritten()->isVoidType())
- return;
-
- diag(CastExpr->getLocStart(), "C-style casts are discouraged. Use "
- "static_cast/const_cast/reinterpret_cast "
- "instead.");
- // FIXME: Suggest appropriate C++ cast. See [expr.cast] for cast notation
- // semantics.
-}
-
-} // namespace readability
-} // namespace tidy
-} // namespace clang
diff --git a/clang-tools-extra/clang-tidy/google/CStyleCastsCheck.h b/clang-tools-extra/clang-tidy/google/CStyleCastsCheck.h
deleted file mode 100644
index b6462b38c40..00000000000
--- a/clang-tools-extra/clang-tidy/google/CStyleCastsCheck.h
+++ /dev/null
@@ -1,33 +0,0 @@
-//===--- CStyleCastsCheck.h - clang-tidy ------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GOOGLE_C_STYLE_CASTS_CHECK_H
-#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GOOGLE_C_STYLE_CASTS_CHECK_H
-
-#include "../ClangTidy.h"
-
-namespace clang {
-namespace tidy {
-namespace readability {
-
-/// \brief Finds usages of C-style casts.
-///
-/// http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml?showone=Casting#Casting
-/// Corresponding cpplint.py check name: 'readability/casting'.
-class CStyleCastsCheck : public ClangTidyCheck {
-public:
- void registerMatchers(ast_matchers::MatchFinder *Finder) override;
- void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
-};
-
-} // namespace readability
-} // namespace tidy
-} // namespace clang
-
-#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GOOGLE_C_STYLE_CASTS_CHECK_H
diff --git a/clang-tools-extra/clang-tidy/google/GoogleTidyModule.cpp b/clang-tools-extra/clang-tidy/google/GoogleTidyModule.cpp
index bafaada451b..05787cf214d 100644
--- a/clang-tools-extra/clang-tidy/google/GoogleTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/google/GoogleTidyModule.cpp
@@ -10,7 +10,6 @@
#include "../ClangTidy.h"
#include "../ClangTidyModule.h"
#include "../ClangTidyModuleRegistry.h"
-#include "CStyleCastsCheck.h"
#include "ExplicitConstructorCheck.h"
using namespace clang::ast_matchers;
@@ -24,9 +23,6 @@ public:
CheckFactories.addCheckFactory(
"google-explicit-constructor",
new ClangTidyCheckFactory<ExplicitConstructorCheck>());
- CheckFactories.addCheckFactory(
- "google-readability-casting",
- new ClangTidyCheckFactory<readability::CStyleCastsCheck>());
}
};
OpenPOWER on IntegriCloud