Kaydet (Commit) 3f3c4000 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

loplugin:cstylecast: nop between pointer types of exactly same spelling

Change-Id: I16fdb3a6e92c854f4143b5afd19d33818735222b
üst 7011bf78
...@@ -53,7 +53,6 @@ private: ...@@ -53,7 +53,6 @@ private:
static const char * recommendedFix(clang::CastKind ck) { static const char * recommendedFix(clang::CastKind ck) {
switch(ck) { switch(ck) {
case CK_NoOp: return "const_cast";
case CK_IntegralToPointer: return "reinterpret_cast"; case CK_IntegralToPointer: return "reinterpret_cast";
case CK_PointerToIntegral: return "reinterpret_cast"; case CK_PointerToIntegral: return "reinterpret_cast";
case CK_BaseToDerived: return "static_cast"; case CK_BaseToDerived: return "static_cast";
...@@ -101,9 +100,11 @@ bool CStyleCast::VisitCStyleCastExpr(const CStyleCastExpr * expr) { ...@@ -101,9 +100,11 @@ bool CStyleCast::VisitCStyleCastExpr(const CStyleCastExpr * expr) {
} else { } else {
return true; return true;
} }
if (!t1.isMoreQualifiedThan(t2) if (expr->getSubExprAsWritten()->getType() != expr->getType()
&& (!t1.isMoreQualifiedThan(t2)
|| (t1.getUnqualifiedType().getCanonicalType().getTypePtr() || (t1.getUnqualifiedType().getCanonicalType().getTypePtr()
!= t2.getUnqualifiedType().getCanonicalType().getTypePtr())) != (t2.getUnqualifiedType().getCanonicalType()
.getTypePtr()))))
{ {
return true; return true;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment