summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compilerplugins/clang/redundantcast.cxx10
-rw-r--r--compilerplugins/clang/test/redundantcast.cxx17
-rw-r--r--compilerplugins/clang/test/redundantcast.hxx2
-rw-r--r--sc/source/ui/unoobj/PivotTableDataProvider.cxx4
-rw-r--r--sd/source/ui/unoidl/unopage.cxx2
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx2
6 files changed, 26 insertions, 11 deletions
diff --git a/compilerplugins/clang/redundantcast.cxx b/compilerplugins/clang/redundantcast.cxx
index 32f7e8bd7fd9..dba573387743 100644
--- a/compilerplugins/clang/redundantcast.cxx
+++ b/compilerplugins/clang/redundantcast.cxx
@@ -650,19 +650,15 @@ bool RedundantCast::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr const * exp
}
auto const t1 = expr->getTypeAsWritten();
- auto const t2 = sub->getType().getDesugaredType(compiler.getASTContext()); // look through templated wrapped types
- if (t1 != t2)
- return true;
- // if we are casting from/to a typedef, ignore it, even if the underlying types are the same
- if ((loplugin::TypeCheck(t1).Typedef() || loplugin::TypeCheck(sub->getType()).Typedef())
- && t1 != sub->getType())
+ auto const t2 = sub->getType();
+ if (t1.getCanonicalType() != t2.getCanonicalType())
return true;
if (!isOkToRemoveArithmeticCast(t1, t2, expr->getSubExpr()))
return true;
report(
DiagnosticsEngine::Warning,
"redundant functional cast from %0 to %1", expr->getExprLoc())
- << sub->getType() << t1 << expr->getSourceRange();
+ << t2 << t1 << expr->getSourceRange();
return true;
}
diff --git a/compilerplugins/clang/test/redundantcast.cxx b/compilerplugins/clang/test/redundantcast.cxx
index db1268b8b87b..5a56ec42e32e 100644
--- a/compilerplugins/clang/test/redundantcast.cxx
+++ b/compilerplugins/clang/test/redundantcast.cxx
@@ -300,6 +300,23 @@ bool testCStyleCastOfTemplateMethodResult(Enum1Item* item) {
return (Enum1)item->GetValue() == Enum1::X; // expected-error {{redundant cstyle cast from 'Enum1' to 'Enum1' [loplugin:redundantcast]}}
}
+using T1 = int;
+T1 nt1r() { return 0; }
+void testArithmeticTypedefs() {
+ (void) static_cast<T1>(nir());
+ (void) T1(nir());
+ (void) (T1) nir();
+ (void) static_cast<int>(nt1r());
+ (void) int(nt1r());
+ (void) (int) nt1r();
+ using T2 = T1;
+ (void) static_cast<T2>(nt1r());
+ (void) T2(nt1r());
+ (void) (T2) nt1r();
+ (void) static_cast<T1>(nt1r()); // expected-error {{redundant}}
+ (void) T1(nt1r()); // expected-error {{redundant}}
+ (void) (T1) nt1r(); // expected-error {{redundant}}
+}
int main() {
testConstCast();
diff --git a/compilerplugins/clang/test/redundantcast.hxx b/compilerplugins/clang/test/redundantcast.hxx
index e87da7a55fe4..014aecea4dc3 100644
--- a/compilerplugins/clang/test/redundantcast.hxx
+++ b/compilerplugins/clang/test/redundantcast.hxx
@@ -30,6 +30,8 @@ S const && csx();
S nsr();
S const csr();
+void testArithmeticTypedefs();
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/sc/source/ui/unoobj/PivotTableDataProvider.cxx b/sc/source/ui/unoobj/PivotTableDataProvider.cxx
index 7d5a3bfa90c7..581e5a9c9b25 100644
--- a/sc/source/ui/unoobj/PivotTableDataProvider.cxx
+++ b/sc/source/ui/unoobj/PivotTableDataProvider.cxx
@@ -358,9 +358,9 @@ void PivotTableDataProvider::collectPivotTableData()
if (!xDimProp.is() || !xDimSupp.is())
continue;
- sheet::DataPilotFieldOrientation eDimOrient = sheet::DataPilotFieldOrientation(
+ sheet::DataPilotFieldOrientation eDimOrient =
ScUnoHelpFunctions::GetEnumProperty(xDimProp, SC_UNO_DP_ORIENTATION,
- sheet::DataPilotFieldOrientation_HIDDEN));
+ sheet::DataPilotFieldOrientation_HIDDEN);
if (eDimOrient == sheet::DataPilotFieldOrientation_HIDDEN)
continue;
diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx
index 5976b90b56fa..84f7a8399f36 100644
--- a/sd/source/ui/unoidl/unopage.cxx
+++ b/sd/source/ui/unoidl/unopage.cxx
@@ -1046,7 +1046,7 @@ Any SAL_CALL SdGenericDrawPage::getPropertyValue( const OUString& PropertyName )
: view::PaperOrientation_LANDSCAPE);
break;
case WID_PAGE_EFFECT:
- aAny <<= presentation::FadeEffect(GetPage()->GetFadeEffect());
+ aAny <<= GetPage()->GetFadeEffect();
break;
case WID_PAGE_CHANGE:
aAny <<= (sal_Int32)( GetPage()->GetPresChange() );
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 1b777821b8b3..86bc36629fa7 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1040,7 +1040,7 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( )
aFrameProperties.push_back(comphelper::makePropertyValue("VertOrientRelation", sal_Int16(rAppendContext.pLastParagraphProperties->GetvAnchor())));
if( rAppendContext.pLastParagraphProperties->GetWrap() >= text::WrapTextMode_NONE )
- aFrameProperties.push_back(comphelper::makePropertyValue("Surround", text::WrapTextMode(rAppendContext.pLastParagraphProperties->GetWrap())));
+ aFrameProperties.push_back(comphelper::makePropertyValue("Surround", rAppendContext.pLastParagraphProperties->GetWrap()));
lcl_MoveBorderPropertiesToFrame(aFrameProperties,
rAppendContext.pLastParagraphProperties->GetStartingRange(),