-
Notifications
You must be signed in to change notification settings - Fork 15.5k
[clang-tidy] Rename google-readability-casting to modernize-avoid-c-style-cast
#171058
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[clang-tidy] Rename google-readability-casting to modernize-avoid-c-style-cast
#171058
Conversation
…tyle-cast The old name is kept as an alias for backward compatibility. Fixes llvm#170978
|
@llvm/pr-subscribers-clang-tidy @llvm/pr-subscribers-clang-tools-extra Author: Islam Imad (Islam-Imad) Changes[clang-tidy] Rename google-readability-casting to modernize-avoid-c-style-cast The old name is kept as an alias for backward compatibility. Fixes #170978 Patch is 20.30 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/171058.diff 17 Files Affected:
diff --git a/clang-tools-extra/clang-tidy/google/CMakeLists.txt b/clang-tools-extra/clang-tidy/google/CMakeLists.txt
index 1d4229ebb7b09..ac053bc92a0a4 100644
--- a/clang-tools-extra/clang-tidy/google/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/google/CMakeLists.txt
@@ -4,7 +4,6 @@ set(LLVM_LINK_COMPONENTS
)
add_clang_library(clangTidyGoogleModule STATIC
- AvoidCStyleCastsCheck.cpp
AvoidNSObjectNewCheck.cpp
AvoidThrowingObjCExceptionCheck.cpp
AvoidUnderscoreInGoogletestNameCheck.cpp
diff --git a/clang-tools-extra/clang-tidy/google/GoogleTidyModule.cpp b/clang-tools-extra/clang-tidy/google/GoogleTidyModule.cpp
index aff8b45ff2f74..7080280b4e7bd 100644
--- a/clang-tools-extra/clang-tidy/google/GoogleTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/google/GoogleTidyModule.cpp
@@ -9,10 +9,10 @@
#include "../ClangTidy.h"
#include "../ClangTidyModule.h"
#include "../ClangTidyModuleRegistry.h"
+#include "../modernize/AvoidCStyleCastsCheck.h"
#include "../readability/BracesAroundStatementsCheck.h"
#include "../readability/FunctionSizeCheck.h"
#include "../readability/NamespaceCommentCheck.h"
-#include "AvoidCStyleCastsCheck.h"
#include "AvoidNSObjectNewCheck.h"
#include "AvoidThrowingObjCExceptionCheck.h"
#include "AvoidUnderscoreInGoogletestNameCheck.h"
@@ -67,7 +67,7 @@ class GoogleModule : public ClangTidyModule {
CheckFactories
.registerCheck<readability::AvoidUnderscoreInGoogletestNameCheck>(
"google-readability-avoid-underscore-in-googletest-name");
- CheckFactories.registerCheck<readability::AvoidCStyleCastsCheck>(
+ CheckFactories.registerCheck<modernize::AvoidCStyleCastsCheck>(
"google-readability-casting");
CheckFactories.registerCheck<readability::TodoCommentCheck>(
"google-readability-todo");
diff --git a/clang-tools-extra/clang-tidy/google/AvoidCStyleCastsCheck.cpp b/clang-tools-extra/clang-tidy/modernize/AvoidCStyleCastsCheck.cpp
similarity index 99%
rename from clang-tools-extra/clang-tidy/google/AvoidCStyleCastsCheck.cpp
rename to clang-tools-extra/clang-tidy/modernize/AvoidCStyleCastsCheck.cpp
index c438889e22ab7..d76f9d0b74007 100644
--- a/clang-tools-extra/clang-tidy/google/AvoidCStyleCastsCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/AvoidCStyleCastsCheck.cpp
@@ -14,7 +14,7 @@
using namespace clang::ast_matchers;
-namespace clang::tidy::google::readability {
+namespace clang::tidy::modernize {
void AvoidCStyleCastsCheck::registerMatchers(
ast_matchers::MatchFinder *Finder) {
@@ -288,4 +288,4 @@ void AvoidCStyleCastsCheck::check(const MatchFinder::MatchResult &Result) {
Diag << "static_cast/const_cast/reinterpret_cast";
}
-} // namespace clang::tidy::google::readability
+} // namespace clang::tidy::modernize
diff --git a/clang-tools-extra/clang-tidy/google/AvoidCStyleCastsCheck.h b/clang-tools-extra/clang-tidy/modernize/AvoidCStyleCastsCheck.h
similarity index 76%
rename from clang-tools-extra/clang-tidy/google/AvoidCStyleCastsCheck.h
rename to clang-tools-extra/clang-tidy/modernize/AvoidCStyleCastsCheck.h
index a305bd524aefb..920596e260348 100644
--- a/clang-tools-extra/clang-tidy/google/AvoidCStyleCastsCheck.h
+++ b/clang-tools-extra/clang-tidy/modernize/AvoidCStyleCastsCheck.h
@@ -6,12 +6,12 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GOOGLE_AVOIDCSTYLECASTSCHECK_H
-#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GOOGLE_AVOIDCSTYLECASTSCHECK_H
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_AVOIDCSTYLECASTSCHECK_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_AVOIDCSTYLECASTSCHECK_H
#include "../ClangTidyCheck.h"
-namespace clang::tidy::google::readability {
+namespace clang::tidy::modernize {
/// Finds usages of C-style casts.
///
@@ -24,7 +24,7 @@ namespace clang::tidy::google::readability {
/// ones generated by `-Wold-style-cast`.
///
/// For the user-facing documentation see:
-/// https://clang.llvm.org/extra/clang-tidy/checks/google/readability-casting.html
+/// https://clang.llvm.org/extra/clang-tidy/checks/modernize/avoid-c-style-cast.html
class AvoidCStyleCastsCheck : public ClangTidyCheck {
public:
AvoidCStyleCastsCheck(StringRef Name, ClangTidyContext *Context)
@@ -36,6 +36,6 @@ class AvoidCStyleCastsCheck : public ClangTidyCheck {
}
};
-} // namespace clang::tidy::google::readability
+} // namespace clang::tidy::modernize
-#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GOOGLE_AVOIDCSTYLECASTSCHECK_H
+#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_AVOIDCSTYLECASTSCHECK_H
diff --git a/clang-tools-extra/clang-tidy/modernize/CMakeLists.txt b/clang-tools-extra/clang-tidy/modernize/CMakeLists.txt
index 882f2dc9fb4d8..ac26c3d9bec6f 100644
--- a/clang-tools-extra/clang-tidy/modernize/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/modernize/CMakeLists.txt
@@ -6,6 +6,7 @@ set(LLVM_LINK_COMPONENTS
add_clang_library(clangTidyModernizeModule STATIC
AvoidBindCheck.cpp
AvoidCArraysCheck.cpp
+ AvoidCStyleCastsCheck.cpp
AvoidSetjmpLongjmpCheck.cpp
AvoidVariadicFunctionsCheck.cpp
ConcatNestedNamespacesCheck.cpp
diff --git a/clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp b/clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp
index 360e2b8434d0c..793dd3d025e21 100644
--- a/clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp
@@ -11,6 +11,7 @@
#include "../ClangTidyModuleRegistry.h"
#include "AvoidBindCheck.h"
#include "AvoidCArraysCheck.h"
+#include "AvoidCStyleCastsCheck.h"
#include "AvoidSetjmpLongjmpCheck.h"
#include "AvoidVariadicFunctionsCheck.h"
#include "ConcatNestedNamespacesCheck.h"
@@ -65,6 +66,8 @@ class ModernizeModule : public ClangTidyModule {
void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
CheckFactories.registerCheck<AvoidBindCheck>("modernize-avoid-bind");
CheckFactories.registerCheck<AvoidCArraysCheck>("modernize-avoid-c-arrays");
+ CheckFactories.registerCheck<AvoidCStyleCastsCheck>(
+ "modernize-avoid-c-style-cast");
CheckFactories.registerCheck<AvoidSetjmpLongjmpCheck>(
"modernize-avoid-setjmp-longjmp");
CheckFactories.registerCheck<AvoidVariadicFunctionsCheck>(
diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst
index 42160fa9cb51c..322ce8e9d39ea 100644
--- a/clang-tools-extra/docs/ReleaseNotes.rst
+++ b/clang-tools-extra/docs/ReleaseNotes.rst
@@ -328,6 +328,11 @@ New check aliases
<clang-tidy/checks/bugprone/copy-constructor-mutates-argument>`
keeping initial check as an alias to the new one.
+- Renamed :doc:`google-readability-casting <clang-tidy/checks/google/readability-casting>` to
+ :doc:`modernize-avoid-c-style-cast
+ <clang-tidy/checks/modernize/avoid-c-style-cast>`
+ keeping initial check as an alias to the new one.
+
Changes in existing checks
^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/clang-tools-extra/docs/clang-tidy/checks/google/readability-casting.rst b/clang-tools-extra/docs/clang-tidy/checks/google/readability-casting.rst
index d927e1ce29fce..1d0c24cf375e7 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/google/readability-casting.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/google/readability-casting.rst
@@ -3,12 +3,4 @@
google-readability-casting
==========================
-Finds usages of C-style casts.
-
-https://google.github.io/styleguide/cppguide.html#Casting
-
-Corresponding cpplint.py check name: `readability/casting`.
-
-This check is similar to ``-Wold-style-cast``, but it suggests automated fixes
-in some cases. The reported locations should not be different from the
-ones generated by ``-Wold-style-cast``.
+The `google-readability-casting` check is an alias, please see `modernize-avoid-c-style-cast <../modernize/avoid-c-style-cast.html>`_ for more information.
diff --git a/clang-tools-extra/docs/clang-tidy/checks/list.rst b/clang-tools-extra/docs/clang-tidy/checks/list.rst
index 8bb112f3d1832..865a2d34e94c2 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/list.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/list.rst
@@ -239,7 +239,6 @@ Clang-Tidy Checks
:doc:`google-objc-function-naming <google/objc-function-naming>`,
:doc:`google-objc-global-variable-declaration <google/objc-global-variable-declaration>`,
:doc:`google-readability-avoid-underscore-in-googletest-name <google/readability-avoid-underscore-in-googletest-name>`,
- :doc:`google-readability-casting <google/readability-casting>`,
:doc:`google-readability-todo <google/readability-todo>`,
:doc:`google-runtime-float <google/runtime-float>`,
:doc:`google-runtime-int <google/runtime-int>`,
@@ -291,6 +290,7 @@ Clang-Tidy Checks
:doc:`misc-use-internal-linkage <misc/use-internal-linkage>`, "Yes"
:doc:`modernize-avoid-bind <modernize/avoid-bind>`, "Yes"
:doc:`modernize-avoid-c-arrays <modernize/avoid-c-arrays>`,
+ :doc:`modernize-avoid-c-style-cast <modernize/avoid-c-style-cast>`,
:doc:`modernize-avoid-setjmp-longjmp <modernize/avoid-setjmp-longjmp>`,
:doc:`modernize-avoid-variadic-functions <modernize/avoid-variadic-functions>`,
:doc:`modernize-concat-nested-namespaces <modernize/concat-nested-namespaces>`, "Yes"
@@ -585,6 +585,7 @@ Check aliases
:doc:`cppcoreguidelines-use-default-member-init <cppcoreguidelines/use-default-member-init>`, :doc:`modernize-use-default-member-init <modernize/use-default-member-init>`, "Yes"
:doc:`fuchsia-header-anon-namespaces <fuchsia/header-anon-namespaces>`, :doc:`google-build-namespaces <google/build-namespaces>`,
:doc:`google-readability-braces-around-statements <google/readability-braces-around-statements>`, :doc:`readability-braces-around-statements <readability/braces-around-statements>`, "Yes"
+ :doc:`google-readability-casting <google/readability-casting>`, :doc:`modernize-avoid-c-style-cast <modernize/avoid-c-style-cast>`,
:doc:`google-readability-function-size <google/readability-function-size>`, :doc:`readability-function-size <readability/function-size>`,
:doc:`google-readability-namespace-comments <google/readability-namespace-comments>`, :doc:`llvm-namespace-comment <llvm/namespace-comment>`,
:doc:`hicpp-avoid-c-arrays <hicpp/avoid-c-arrays>`, :doc:`modernize-avoid-c-arrays <modernize/avoid-c-arrays>`,
diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/avoid-c-style-cast.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/avoid-c-style-cast.rst
new file mode 100644
index 0000000000000..def559a01c907
--- /dev/null
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/avoid-c-style-cast.rst
@@ -0,0 +1,14 @@
+.. title:: clang-tidy - modernize-avoid-c-style-cast
+
+modernize-avoid-c-style-cast
+==========================
+
+Finds usages of C-style casts.
+
+https://google.github.io/styleguide/cppguide.html#Casting
+
+Corresponding cpplint.py check name: `readability/casting`.
+
+This check is similar to ``-Wold-style-cast``, but it suggests automated fixes
+in some cases. The reported locations should not be different from the
+ones generated by ``-Wold-style-cast``.
diff --git a/clang-tools-extra/test/clang-tidy/checkers/google/readability-casting.c b/clang-tools-extra/test/clang-tidy/checkers/google/readability-casting.c
deleted file mode 100644
index f0d53395576a6..0000000000000
--- a/clang-tools-extra/test/clang-tidy/checkers/google/readability-casting.c
+++ /dev/null
@@ -1,24 +0,0 @@
-// RUN: %check_clang_tidy %s google-readability-casting %t -- -- -x c
-// The testing script always adds .cpp extension to the input file name, so we
-// need to run clang-tidy directly in order to verify handling of .c files:
-// RUN: clang-tidy --checks=-*,google-readability-casting %s -- -x c++ | FileCheck %s -check-prefix=CHECK-MESSAGES -implicit-check-not='{{warning|error}}:'
-// RUN: cp %s %t.main_file.cpp
-// RUN: clang-tidy --checks=-*,google-readability-casting -header-filter='.*' %t.main_file.cpp -- -I%S -DTEST_INCLUDE -x c++ | FileCheck %s -check-prefix=CHECK-MESSAGES -implicit-check-not='{{warning|error}}:'
-
-#ifdef TEST_INCLUDE
-
-#undef TEST_INCLUDE
-#include "readability-casting.c"
-
-#else
-
-void f(const char *cpc) {
- const char *cpc2 = (const char*)cpc;
- // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: redundant cast to the same type [google-readability-casting]
- // CHECK-FIXES: const char *cpc2 = cpc;
- char *pc = (char*)cpc;
- typedef const char *Typedef1;
- (Typedef1)cpc;
-}
-
-#endif
diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-style-cast.c b/clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-style-cast.c
new file mode 100644
index 0000000000000..7dfdc7be7560e
--- /dev/null
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-style-cast.c
@@ -0,0 +1,24 @@
+// RUN: %check_clang_tidy %s modernize-avoid-c-style-cast %t -- -- -x c
+// The testing script always adds .cpp extension to the input file name, so we
+// need to run clang-tidy directly in order to verify handling of .c files:
+// RUN: clang-tidy --checks=-*,modernize-avoid-c-style-cast %s -- -x c++ | FileCheck %s -check-prefix=CHECK-MESSAGES -implicit-check-not='{{warning|error}}:'
+// RUN: cp %s %t.main_file.cpp
+// RUN: clang-tidy --checks=-*,modernize-avoid-c-style-cast -header-filter='.*' %t.main_file.cpp -- -I%S -DTEST_INCLUDE -x c++ | FileCheck %s -check-prefix=CHECK-MESSAGES -implicit-check-not='{{warning|error}}:'
+
+#ifdef TEST_INCLUDE
+
+#undef TEST_INCLUDE
+#include "avoid-c-style-cast.c"
+
+#else
+
+void f(const char *cpc) {
+ const char *cpc2 = (const char*)cpc;
+ // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: redundant cast to the same type [modernize-avoid-c-style-cast]
+ // CHECK-FIXES: const char *cpc2 = cpc;
+ char *pc = (char*)cpc;
+ typedef const char *Typedef1;
+ (Typedef1)cpc;
+}
+
+#endif
diff --git a/clang-tools-extra/test/clang-tidy/checkers/google/readability-casting.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-style-cast.cpp
similarity index 98%
rename from clang-tools-extra/test/clang-tidy/checkers/google/readability-casting.cpp
rename to clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-style-cast.cpp
index d8e8c5017a9b2..52b4d471bda9b 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/google/readability-casting.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-style-cast.cpp
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy -std=c++11-or-later %s google-readability-casting %t -- -- -fexceptions
+// RUN: %check_clang_tidy -std=c++11-or-later %s modernize-avoid-c-style-cast %t -- -- -fexceptions
bool g() { return false; }
@@ -8,14 +8,14 @@ struct Y : public X {};
void f(int a, double b, const char *cpc, const void *cpv, X *pX) {
const char *cpc2 = (const char*)cpc;
- // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: redundant cast to the same type [google-readability-casting]
+ // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: redundant cast to the same type [modernize-avoid-c-style-cast]
// CHECK-FIXES: const char *cpc2 = cpc;
typedef const char *Typedef1;
typedef const char *Typedef2;
Typedef1 t1;
(Typedef2)t1;
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: C-style casts are discouraged; use static_cast (if needed, the cast may be redundant) [google-readability-casting]
+ // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: C-style casts are discouraged; use static_cast (if needed, the cast may be redundant) [modernize-avoid-c-style-cast]
// CHECK-FIXES: static_cast<Typedef2>(t1);
(const char*)t1;
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: {{.*}}; use static_cast (if needed
@@ -28,7 +28,7 @@ void f(int a, double b, const char *cpc, const void *cpv, X *pX) {
// CHECK-FIXES: t1;
char *pc = (char*)cpc;
- // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: C-style casts are discouraged; use const_cast [google-readability-casting]
+ // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: C-style casts are discouraged; use const_cast [modernize-avoid-c-style-cast]
// CHECK-FIXES: char *pc = const_cast<char*>(cpc);
typedef char Char;
Char *pChar = (Char*)pc;
diff --git a/clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-LIFO.cpp b/clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-LIFO.cpp
index ee5b1cca755ab..e86b3df34fcfc 100644
--- a/clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-LIFO.cpp
+++ b/clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-LIFO.cpp
@@ -1,11 +1,11 @@
-// RUN: not clang-tidy %s --checks='-*,google-explicit-constructor,google-readability-casting' 2>&1 | FileCheck %s
+// RUN: not clang-tidy %s --checks='-*,google-explicit-constructor,modernize-avoid-c-style-cast' 2>&1 | FileCheck %s
// NOLINTBEGIN(google-explicit-constructor)
-// NOLINTBEGIN(google-readability-casting)
+// NOLINTBEGIN(modernize-avoid-c-style-cast)
class A { A(int i); };
auto Num = (unsigned int)(-1);
// NOLINTEND(google-explicit-constructor)
-// NOLINTEND(google-readability-casting)
+// NOLINTEND(modernize-avoid-c-style-cast)
// Note: the expected output has been split over several lines so that clang-tidy
// does not see the "no lint" suppression comment and mistakenly assume it
diff --git a/clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-begin-multiple-end-single.cpp b/clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-begin-multiple-end-single.cpp
index 150913ce0ec69..156a5cb345dbd 100644
--- a/clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-begin-multiple-end-single.cpp
+++ b/clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-begin-multiple-end-single.cpp
@@ -1,10 +1,10 @@
-// RUN: not clang-tidy %s --checks='-*,google-explicit-constructor,google-readability-casting' 2>&1 | FileCheck %s
+// RUN: not clang-tidy %s --checks='-*,google-explicit-constructor,modernize-avoid-c-style-cast' 2>&1 | FileCheck %s
-// NOLINTBEGIN(google-explicit-constructor,google-readability-casting)
+// NOLINTBEGIN(google-explicit-constructor,modernize-avoid-c-style-cast)
class B { B(int i); };
// NOLINTEND(google-explicit-constructor)
auto Num2 = (unsigned int)(-1);
-// NOLINTEND(google-readability-casting)
+// NOLINTEND(modernize-avoid-c-style-cast)
// Note: the expected output has been split over several lines so that clang-tidy
// does not see the "no lint" suppression comment and mistakenly assume it
diff --git a/clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-begin-single-end-multiple.cpp b/clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-begin-single-end-multiple.cpp
index f9a915c890cbb..837213227dc2d 100644
--- a/clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-begin-single-end-multiple.cpp
+++ b/clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-begin-single-end-multiple.cpp
@@ -1,10 +1,10 @@
-// RUN: not clang-tidy %s --checks='-*,google-explicit-constructor,google-readability-casting' 2>&1 | FileCheck %s
+// RUN: not clang-tidy %s --checks='-*,google-explicit-constructor,modernize-avoid-c-style-cast' 2>&1 | FileCheck %s
// NOLINTBEGIN(google-explicit-constructor)
-// NOLINTBEGIN(google-readability-casting)
+// NOLINTBEGIN(modernize-avoid-c-style-cast)
class B { B(int i); };
auto Num2 = (unsigned int)(-1);
-// NOLINTEND(google-explicit-constructor,google-readability-casting)
+// NOLINTEND(google-explicit-constructor,modernize-avoid-c-style-cast)
// Note: the expected output has been split over several lines so that clang-tidy
// does not see the "no lint" suppression comment and mistakenly assume it
diff --git a/clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-mismatched-check-names.cpp b/clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-mismatched-check-names.cpp
index 8d7786fb8c712..ddd399dfc764f 100644
--- a/clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-mismatched-check-names.cpp
+++ b/clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-mismatched-check-names.cpp
@@ -1,9 +1,9 @@
-// RUN: not clang-tidy %s --checks='-*,google-explicit-constructor,google-readability-casting' 2>&1 | FileCheck %s
+// RUN: not clang-tidy %s --checks='-*,google-explicit-constructor,modernize-avoid-c-style-cast' 2>&1 | FileCheck %s
// NOLINTBEGIN(google-explicit-constructor)
...
[truncated]
|
clang-tools-extra/docs/clang-tidy/checks/google/readability-casting.rst
Outdated
Show resolved
Hide resolved
clang-tools-extra/docs/clang-tidy/checks/modernize/avoid-c-style-cast.rst
Outdated
Show resolved
Hide resolved
Make the check name consistent with other modernize checks by using singular form. Also improve documentation with concrete examples.
|
✅ With the latest revision this PR passed the C/C++ code linter. |
clang-tools-extra/docs/clang-tidy/checks/google/readability-casting.rst
Outdated
Show resolved
Hide resolved
- Updated header guards accordingly - Updated registrations in ModernizeTidyModule.cpp and GoogleTidyModule.cpp - Fixed documentation link formatting in google-readability-casting.rst
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
update function signature to fit into one line
zeyi2
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for the fix!
Please wait for other reviewers' reviews.
clang-tools-extra/docs/clang-tidy/checks/modernize/avoid-c-style-cast.rst
Outdated
Show resolved
Hide resolved
clang-tools-extra/docs/clang-tidy/checks/modernize/avoid-c-style-cast.rst
Outdated
Show resolved
Hide resolved
|
😶🌫️ any feedback :) |
clang-tools-extra/docs/clang-tidy/checks/modernize/avoid-c-style-cast.rst
Show resolved
Hide resolved
google-readability-casting to modernize-avoid-c-style-cast
zeyi2
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll help merge this PR later, thanks for the fix :)
Thanks for your time :) |
|
|
||
| modernize-avoid-c-style-cast | ||
| ============================ | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Finds usages of C-style casts. |
Forgot the initial line
|
|
||
| https://google.github.io/styleguide/cppguide.html#Casting | ||
|
|
||
| Corresponding cpplint.py check name: `readability/casting`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This cpplint.py should be left in readability-casting.rst because it is google's tool and I see no reason to remove it from here.
|
Sorry that I merged it too soon, should we revert it or fix the remaining issues in another PR? Update: I opened #171413 to fix this. |
…1413) Related discussion: #171058 (comment)
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/27/builds/20073 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/145/builds/11347 Here is the relevant piece of the build log for the reference |
…-cast` (#171413) Related discussion: llvm/llvm-project#171058 (comment)
|
Opened #171427 for link failures |
… link libs (#171427) Fixes failures in llvm/llvm-project#171058 (comment)
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/76/builds/13539 Here is the relevant piece of the build log for the reference |
|
First of all, sorry about these failure and errors. |
|
No worries! As for why it happens in CI but not locally: are you maybe on Windows and using Microsoft's toolchain? CI uses Linux, so that could be the source of the difference (just a guess though). |
The latter comment about failure seems outdated because the initial problem must be fixed by #171427. |
I use Ubuntu 24 :) |
BUILD_SHARED_LIBS:BOOL=OFF (the problem 🥲) |
Rename
google-readability-castingtomodernize-avoid-c-style-castThe old name is kept as an alias for backward compatibility.
Fixes #170978