================
@@ -269,6 +269,12 @@ void AvoidCStyleCastsCheck::check(const
MatchFinder::MatchResult &Result) {
return;
}
break;
+ case CK_BaseToDerived:
+ if (!needsConstCast(SourceType, DestType)) {
+ ReplaceWithNamedCast("static_cast");
+ return;
+ }
+ break;
----------------
ckandeler wrote:
The fact that the code uses an unchecked cast implies a priori knowledge about
the safety to do so, so static_cast seems to be the correct equivalent. Using
dynamic_cast would likely incur unwanted overhead.
(I'm not too familiar with the clang-tidy code base: Is it possible/recommended
to suggest competing fixes? If so, what happens to the respective code if --fix
is used?)
https://github.com/llvm/llvm-project/pull/165411
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits