summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-06-03 21:15:30 +0200
committerStephan Bergmann <sbergman@redhat.com>2017-06-05 21:18:14 +0200
commit2725f884655f1ef5c3de661ef03bef64405212ed (patch)
tree390be33a2bd66d385df121b1e1617b842169b327 /compilerplugins
parent3fdfbe68bad1bd99b6adaf756caa12941c15b9e5 (diff)
Improved loplugin:cstylecast to reference types
Change-Id: Ie95ab6d588cfe40cc9748ce526b80d06fe825da5
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/cstylecast.cxx9
1 files changed, 4 insertions, 5 deletions
diff --git a/compilerplugins/clang/cstylecast.cxx b/compilerplugins/clang/cstylecast.cxx
index 62d25acdaf20..8504ca573dcb 100644
--- a/compilerplugins/clang/cstylecast.cxx
+++ b/compilerplugins/clang/cstylecast.cxx
@@ -142,10 +142,9 @@ bool CStyleCast::VisitCStyleCastExpr(const CStyleCastExpr * expr) {
}
char const * perf = nullptr;
if( expr->getCastKind() == CK_NoOp ) {
- QualType t1 = expr->getSubExpr()->getType();
- QualType t2 = expr->getType();
- if (!((t1->isPointerType() && t2->isPointerType())
- || (t1->isLValueReferenceType() && t2->isLValueReferenceType())))
+ if (!((expr->getSubExpr()->getType()->isPointerType()
+ && expr->getType()->isPointerType())
+ || expr->getTypeAsWritten()->isReferenceType()))
{
return true;
}
@@ -182,7 +181,7 @@ bool CStyleCast::VisitCStyleCastExpr(const CStyleCastExpr * expr) {
DiagnosticsEngine::Warning, "C-style cast from %0%1 to %2%3%4 (%5)",
expr->getSourceRange().getBegin())
<< incompFrom << expr->getSubExprAsWritten()->getType()
- << incompTo << expr->getType() << performs
+ << incompTo << expr->getTypeAsWritten() << performs
<< expr->getCastKindName()
<< expr->getSourceRange();
return true;