[PATCH] D14096: [clang-tidy] add new check cppcoreguidelines-pro-type-cstyle-cast
Samuel Benzaquen via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 26 16:25:59 PDT 2015
sbenza added inline comments.
================
Comment at: clang-tidy/cppcoreguidelines/ProTypeCstyleCastCheck.cpp:44
@@ +43,3 @@
+ if (MatchedCast->getCastKind() == CK_BitCast ||
+ MatchedCast->getCastKind() == CK_LValueBitCast ||
+ MatchedCast->getCastKind() == CK_IntegralToPointer ||
----------------
Seems to be missing CK_ReinterpretMemberPointer
================
Comment at: clang-tidy/cppcoreguidelines/ProTypeCstyleCastCheck.cpp:48
@@ +47,3 @@
+ diag(MatchedCast->getLocStart(),
+ "do not use c-style cast to perform a reinterpret_cast");
+ return;
----------------
>From reading warning this I would think the way to fix the code is to use a reinterpret_cast directly, but that is also against the guidelines.
================
Comment at: clang-tidy/cppcoreguidelines/ProTypeCstyleCastCheck.cpp:55
@@ +54,3 @@
+ if (MatchedCast->getCastKind() == CK_BaseToDerived) {
+
+ const auto *SourceDecl = SourceType->getPointeeCXXRecordDecl();
----------------
remove blank line
http://reviews.llvm.org/D14096
More information about the cfe-commits
mailing list