[PATCH] D14096: [clang-tidy] add new check cppcoreguidelines-pro-type-cstyle-cast

Matthias Gehre via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 2 11:57:03 PST 2015


mgehre added inline comments.

================
Comment at: clang-tidy/cppcoreguidelines/ProTypeCstyleCastCheck.cpp:79
@@ +78,3 @@
+          MatchedCast->getSubExprAsWritten()->IgnoreImpCasts();
+      std::string CastText = ("dynamic_cast<" + DestTypeString + ">").str();
+      if (!isa<ParenExpr>(SubExpr)) {
----------------
aaron.ballman wrote:
> How does this handle a case like:
> ```
> SomeClass::type *derived = (SomeClass::type *)someBase;
> ```
> Will it leave the spelling as "SomeClass::type *", or replace it with the underlying type from the typedef? (I suspect it leaves it as-is, but it would be good to have tests for more complex code patterns.)
I copied the fixit part from the google c-style cast check. I will add some more test for it.


http://reviews.llvm.org/D14096





More information about the cfe-commits mailing list