Kaydet (Commit) 612b489d authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:checkunusedparams

the "check for taking address of function" part was generating false+

Change-Id: Iad6203850901229b7b1b2f8938c68ec703cd343f
Reviewed-on: https://gerrit.libreoffice.org/40613Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 17e14d45
......@@ -101,12 +101,12 @@ protected:
virtual ~SbStdClipboard() override;
virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
static void MethClear( SbxVariable* pVar, SbxArray const * pPar_, bool bWrite );
static void MethGetData( SbxArray* pPar_, bool bWrite );
static void MethGetFormat( SbxVariable* pVar, SbxArray* pPar_, bool bWrite );
static void MethGetText( SbxVariable* pVar, SbxArray const * pPar_, bool bWrite );
static void MethSetData( SbxArray* pPar_, bool bWrite );
static void MethSetText( SbxArray const * pPar_, bool bWrite );
static void MethClear( SbxArray const * pPar_ );
static void MethGetData( SbxArray* pPar_ );
static void MethGetFormat( SbxVariable* pVar, SbxArray* pPar_ );
static void MethGetText( SbxVariable* pVar, SbxArray const * pPar_ );
static void MethSetData( SbxArray* pPar_ );
static void MethSetText( SbxArray const * pPar_ );
public:
......
......@@ -277,7 +277,7 @@ void SbStdFont::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
}
void SbStdClipboard::MethClear( SbxVariable*, SbxArray const * pPar_, bool )
void SbStdClipboard::MethClear( SbxArray const * pPar_ )
{
if( pPar_ && (pPar_->Count() > 1) )
{
......@@ -287,7 +287,7 @@ void SbStdClipboard::MethClear( SbxVariable*, SbxArray const * pPar_, bool )
}
void SbStdClipboard::MethGetData( SbxArray* pPar_, bool )
void SbStdClipboard::MethGetData( SbxArray* pPar_ )
{
if( !pPar_ || (pPar_->Count() != 2) )
{
......@@ -304,7 +304,7 @@ void SbStdClipboard::MethGetData( SbxArray* pPar_, bool )
}
void SbStdClipboard::MethGetFormat( SbxVariable* pVar, SbxArray* pPar_, bool )
void SbStdClipboard::MethGetFormat( SbxVariable* pVar, SbxArray* pPar_ )
{
if( !pPar_ || (pPar_->Count() != 2) )
{
......@@ -322,7 +322,7 @@ void SbStdClipboard::MethGetFormat( SbxVariable* pVar, SbxArray* pPar_, bool )
pVar->PutBool( false );
}
void SbStdClipboard::MethGetText( SbxVariable* pVar, SbxArray const * pPar_, bool )
void SbStdClipboard::MethGetText( SbxVariable* pVar, SbxArray const * pPar_ )
{
if( pPar_ && (pPar_->Count() > 1) )
{
......@@ -333,7 +333,7 @@ void SbStdClipboard::MethGetText( SbxVariable* pVar, SbxArray const * pPar_, boo
pVar->PutString( OUString() );
}
void SbStdClipboard::MethSetData( SbxArray* pPar_, bool )
void SbStdClipboard::MethSetData( SbxArray* pPar_ )
{
if( !pPar_ || (pPar_->Count() != 3) )
{
......@@ -350,7 +350,7 @@ void SbStdClipboard::MethSetData( SbxArray* pPar_, bool )
}
void SbStdClipboard::MethSetText( SbxArray const * pPar_, bool )
void SbStdClipboard::MethSetText( SbxArray const * pPar_ )
{
if( !pPar_ || (pPar_->Count() != 2) )
{
......@@ -408,17 +408,16 @@ void SbStdClipboard::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
SbxVariable* pVar = pHint->GetVar();
SbxArray* pPar_ = pVar->GetParameters();
const sal_uInt32 nWhich = pVar->GetUserData();
bool bWrite = pHint->GetId() == SfxHintId::BasicDataChanged;
// Methods
switch( nWhich )
{
case METH_CLEAR: MethClear( pVar, pPar_, bWrite ); return;
case METH_GETDATA: MethGetData( pPar_, bWrite ); return;
case METH_GETFORMAT: MethGetFormat( pVar, pPar_, bWrite ); return;
case METH_GETTEXT: MethGetText( pVar, pPar_, bWrite ); return;
case METH_SETDATA: MethSetData( pPar_, bWrite ); return;
case METH_SETTEXT: MethSetText( pPar_, bWrite ); return;
case METH_CLEAR: MethClear( pPar_ ); return;
case METH_GETDATA: MethGetData( pPar_ ); return;
case METH_GETFORMAT: MethGetFormat( pVar, pPar_ ); return;
case METH_GETTEXT: MethGetText( pVar, pPar_ ); return;
case METH_SETDATA: MethSetData( pPar_ ); return;
case METH_SETTEXT: MethSetText( pPar_ ); return;
}
SbxObject::Notify( rBC, rHint );
......
......@@ -581,15 +581,6 @@ namespace canvas
}
}
void verifyInput( const rendering::FontInfo& /*fontInfo*/,
const char* /*pStr*/,
const uno::Reference< uno::XInterface >& /*xIf*/,
::sal_Int16 /*nArgPos*/ )
{
// TODO(E3): Implement FontDescription checks, once the
// Panose stuff is ready.
}
void verifyInput( const rendering::FontRequest& fontRequest,
const char* pStr,
const uno::Reference< uno::XInterface >& xIf,
......
......@@ -153,7 +153,7 @@ void WrappedAxisAndGridExistenceProperty::setPropertyValue( const Any& rOuterVal
if( m_bAxis )
AxisHelper::showAxis( m_nDimensionIndex, m_bMain, xDiagram, m_spChart2ModelContact->m_xContext );
else
AxisHelper::showGrid( m_nDimensionIndex, 0, m_bMain, xDiagram, m_spChart2ModelContact->m_xContext );
AxisHelper::showGrid( m_nDimensionIndex, 0, m_bMain, xDiagram );
}
else
{
......
......@@ -813,8 +813,7 @@ void WrappedRegressionCurvesProperty::setValueToSeries( const Reference< beans::
RegressionCurveHelper::changeRegressionCurveType(
eNewRegressionType,
xRegressionCurveContainer,
xRegressionCurve,
uno::Reference< uno::XComponentContext >());
xRegressionCurve);
}
}
......
......@@ -141,7 +141,7 @@ void TitlesAndObjectsTabPage::commitToModel()
aNewExistenceList[1] = m_pCB_Grid_Y->IsChecked();
aNewExistenceList[2] = m_pCB_Grid_Z->IsChecked();
AxisHelper::changeVisibilityOfGrids( xDiagram
, aOldExistenceList, aNewExistenceList, m_xCC );
, aOldExistenceList, aNewExistenceList );
}
}
......
......@@ -35,7 +35,6 @@ public:
const css::uno::Reference<css::frame::XModel> & xChartModel,
SfxItemPool& rItemPool,
SdrModel& rDrawModel,
const css::uno::Reference<css::lang::XMultiServiceFactory>& xNamedPropertyContainerFactory,
const css::awt::Size* pRefSize = nullptr );
virtual ~AllAxisItemConverter() override;
......
......@@ -43,7 +43,6 @@ AllAxisItemConverter::AllAxisItemConverter(
const uno::Reference< frame::XModel > & xChartModel,
SfxItemPool& rItemPool,
SdrModel& rDrawModel,
const uno::Reference< lang::XMultiServiceFactory > & /*xNamedPropertyContainerFactory*/,
const awt::Size* pRefSize )
: MultipleItemConverter( rItemPool )
{
......
......@@ -162,8 +162,7 @@ bool RegressionCurveItemConverter::ApplySpecialItem(
xCurve = RegressionCurveHelper::changeRegressionCurveType(
eNewRegress,
m_xCurveContainer,
xCurve,
uno::Reference< uno::XComponentContext >());
xCurve);
uno::Reference<beans::XPropertySet> xProperties( xCurve, uno::UNO_QUERY );
resetPropertySet( xProperties );
bChanged = true;
......
......@@ -436,8 +436,7 @@ bool StatisticsItemConverter::ApplySpecialItem(
xCurve = RegressionCurveHelper::changeRegressionCurveType(
eRegress,
xContainer,
xCurve,
uno::Reference< uno::XComponentContext >());
xCurve);
uno::Reference< beans::XPropertySet > xProperties( xCurve, uno::UNO_QUERY );
resetPropertySet( xProperties );
bChanged = true;
......
......@@ -145,7 +145,7 @@ void ChartController::executeDispatch_InsertGrid()
InsertAxisOrGridDialogData aDialogOutput;
aDlg->getResult( aDialogOutput );
bool bChanged = AxisHelper::changeVisibilityOfGrids( xDiagram
, aDialogInput.aExistenceList, aDialogOutput.aExistenceList, m_xCC );
, aDialogInput.aExistenceList, aDialogOutput.aExistenceList );
if( bChanged )
aUndoGuard.commit();
}
......@@ -366,8 +366,7 @@ void ChartController::executeDispatch_InsertTrendline()
uno::Reference< chart2::XRegressionCurve > xCurve =
RegressionCurveHelper::addRegressionCurve(
SvxChartRegress::Linear,
xRegressionCurveContainer,
m_xCC );
xRegressionCurveContainer );
uno::Reference< beans::XPropertySet > xProperties( xCurve, uno::UNO_QUERY );
......
......@@ -313,7 +313,7 @@ wrapper::ItemConverter* createItemConverter(
pItemConverter = new wrapper::AllAxisItemConverter(
xChartModel, rDrawModel.GetItemPool(),
rDrawModel, uno::Reference< lang::XMultiServiceFactory >( xChartModel, uno::UNO_QUERY ), pRefSize.get());
rDrawModel, pRefSize.get());
}
break;
case OBJECTTYPE_GRID:
......
......@@ -879,12 +879,12 @@ void ChartController::executeDispatch_ToggleGridHorizontal()
}
else
{
AxisHelper::showGrid( nDimensionIndex, nCooSysIndex, false, xDiagram, m_xCC );
AxisHelper::showGrid( nDimensionIndex, nCooSysIndex, false, xDiagram );
}
}
else
{
AxisHelper::showGrid( nDimensionIndex, nCooSysIndex, true, xDiagram, m_xCC );
AxisHelper::showGrid( nDimensionIndex, nCooSysIndex, true, xDiagram );
}
aUndoGuard.commit();
}
......@@ -911,12 +911,12 @@ void ChartController::executeDispatch_ToggleGridVertical()
}
else
{
AxisHelper::showGrid( nDimensionIndex, nCooSysIndex, false, xDiagram, m_xCC );
AxisHelper::showGrid( nDimensionIndex, nCooSysIndex, false, xDiagram );
}
}
else
{
AxisHelper::showGrid( nDimensionIndex, nCooSysIndex, true, xDiagram, m_xCC );
AxisHelper::showGrid( nDimensionIndex, nCooSysIndex, true, xDiagram );
}
aUndoGuard.commit();
......
......@@ -155,7 +155,7 @@ void setGridVisible(const css::uno::Reference<css::frame::XModel>& xModel, GridT
if (bVisible)
AxisHelper::showGrid(nDimensionIndex, nCooSysIndex, bMajor,
xDiagram, comphelper::getProcessComponentContext());
xDiagram);
else
AxisHelper::hideGrid(nDimensionIndex, nCooSysIndex, bMajor, xDiagram);
}
......
......@@ -164,8 +164,7 @@ void setTrendlineVisible(const css::uno::Reference<css::frame::XModel>&
{
RegressionCurveHelper::addRegressionCurve(
SvxChartRegress::Linear,
xRegressionCurveContainer,
comphelper::getProcessComponentContext());
xRegressionCurveContainer);
}
else
RegressionCurveHelper::removeAllExceptMeanValueLine(
......
......@@ -77,8 +77,7 @@ public:
, ReferenceSizeProvider * pRefSizeProvider = nullptr );
static void showGrid( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid
, const css::uno::Reference< css::chart2::XDiagram >& xDiagram
, const css::uno::Reference< css::uno::XComponentContext >& xContext );
, const css::uno::Reference< css::chart2::XDiagram >& xDiagram );
static void hideAxis( sal_Int32 nDimensionIndex, bool bMainAxis
, const css::uno::Reference< css::chart2::XDiagram >& xDiagram );
......@@ -174,8 +173,7 @@ public:
static bool changeVisibilityOfGrids( const css::uno::Reference< css::chart2::XDiagram>& xDiagram
, const css::uno::Sequence< sal_Bool >& rOldExistenceList
, const css::uno::Sequence< sal_Bool >& rNewExistenceList
, const css::uno::Reference< css::uno::XComponentContext >& xContext );
, const css::uno::Sequence< sal_Bool >& rNewExistenceList );
static bool changeVisibilityOfAxes( const css::uno::Reference< css::chart2::XDiagram>& xDiagram
, const css::uno::Sequence< sal_Bool >& rOldExistenceList
......
......@@ -119,13 +119,7 @@ public:
, const css::uno::Reference< css::frame::XModel >& xChartModel
, sal_Int32 nSubIndex = -1 );//-1: main grid, 0: first subgrid etc
SAL_DLLPRIVATE static OUString createParticleForDiagram(
const css::uno::Reference< css::chart2::XDiagram >& xDiagram
, ChartModel& rModel);
SAL_DLLPRIVATE static OUString createParticleForDiagram(
const css::uno::Reference< css::chart2::XDiagram >& xDiagram
, const css::uno::Reference< css::frame::XModel >& xChartModel );
SAL_DLLPRIVATE static OUString createParticleForDiagram();
static OUString createParticleForCoordinateSystem(
const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys
......
......@@ -98,7 +98,6 @@ namespace RegressionCurveHelper
addRegressionCurve(
SvxChartRegress eType,
css::uno::Reference<css::chart2::XRegressionCurveContainer> const & xCurveContainer,
const css::uno::Reference<css::uno::XComponentContext>& xContext,
const css::uno::Reference<css::beans::XPropertySet >& xPropertySource =
css::uno::Reference<css::beans::XPropertySet>(),
const css::uno::Reference<css::beans::XPropertySet>& xEquationProperties =
......@@ -114,8 +113,7 @@ namespace RegressionCurveHelper
changeRegressionCurveType(
SvxChartRegress eType,
css::uno::Reference<css::chart2::XRegressionCurveContainer> const & xRegressionCurveContainer,
css::uno::Reference<css::chart2::XRegressionCurve> const & xRegressionCurve,
const css::uno::Reference<css::uno::XComponentContext>& xContext );
css::uno::Reference<css::chart2::XRegressionCurve> const & xRegressionCurve );
/// returns a calculator object for regression curves (used by the view)
OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference<css::chart2::XRegressionCurveCalculator>
......
......@@ -444,8 +444,7 @@ void AxisHelper::showAxis( sal_Int32 nDimensionIndex, bool bMainAxis
}
void AxisHelper::showGrid( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid
, const Reference< XDiagram >& xDiagram
, const Reference< uno::XComponentContext >& /*xContext*/ )
, const Reference< XDiagram >& xDiagram )
{
if( !xDiagram.is() )
return;
......@@ -1021,8 +1020,7 @@ bool AxisHelper::changeVisibilityOfAxes( const Reference< XDiagram >& xDiagram
bool AxisHelper::changeVisibilityOfGrids( const Reference< XDiagram >& xDiagram
, const Sequence< sal_Bool >& rOldExistenceList
, const Sequence< sal_Bool >& rNewExistenceList
, const Reference< uno::XComponentContext >& xContext )
, const Sequence< sal_Bool >& rNewExistenceList )
{
bool bChanged = false;
for(sal_Int32 nN=0;nN<6;nN++)
......@@ -1031,7 +1029,7 @@ bool AxisHelper::changeVisibilityOfGrids( const Reference< XDiagram >& xDiagram
{
bChanged = true;
if(rNewExistenceList[nN])
AxisHelper::showGrid( nN%3, 0, nN<3, xDiagram, xContext );
AxisHelper::showGrid( nN%3, 0, nN<3, xDiagram );
else
AxisHelper::hideGrid( nN%3, 0, nN<3, xDiagram );
}
......
......@@ -364,7 +364,7 @@ OUString ObjectIdentifier::createClassifiedIdentifierForObject(
Reference< XDiagram > xDiagram( xObject, uno::UNO_QUERY );
if( xDiagram.is() )
{
return createClassifiedIdentifierForParticle( createParticleForDiagram( xDiagram, rModel ) );
return createClassifiedIdentifierForParticle( createParticleForDiagram() );
}
//todo
......@@ -446,7 +446,7 @@ OUString ObjectIdentifier::createClassifiedIdentifierForObject(
Reference< XDiagram > xDiagram( xObject, uno::UNO_QUERY );
if( xDiagram.is() )
{
return createClassifiedIdentifierForParticle( createParticleForDiagram( xDiagram, xChartModel ) );
return createClassifiedIdentifierForParticle( createParticleForDiagram() );
}
//todo
......@@ -506,19 +506,9 @@ OUString ObjectIdentifier::createClassifiedIdentifierForParticles(
return aRet.makeStringAndClear();
}
OUString ObjectIdentifier::createParticleForDiagram(
const Reference< XDiagram >& /*xDiagram*/
, ChartModel& /*xChartModel*/ )
OUString ObjectIdentifier::createParticleForDiagram()
{
//todo: if more than one diagram is implemeted, add the correct diagram index here
return OUString("D=0");
}
OUString ObjectIdentifier::createParticleForDiagram(
const Reference< XDiagram >& /*xDiagram*/
, const Reference< frame::XModel >& /*xChartModel*/ )
{
//todo: if more than one diagram is implemeted, add the correct diagram index here
//TODO: if more than one diagram is implemented, add the correct diagram index here
return OUString("D=0");
}
......@@ -539,7 +529,7 @@ OUString ObjectIdentifier::createParticleForCoordinateSystem(
Reference< XCoordinateSystem > xCurrentCooSys( aCooSysList[nCooSysIndex] );
if( xCooSys == xCurrentCooSys )
{
aRet = ObjectIdentifier::createParticleForDiagram( xDiagram, rModel );
aRet = ObjectIdentifier::createParticleForDiagram();
aRet.append(":CS=");
aRet.append( OUString::number( nCooSysIndex ) );
break;
......@@ -567,7 +557,7 @@ OUString ObjectIdentifier::createParticleForCoordinateSystem(
Reference< XCoordinateSystem > xCurrentCooSys( aCooSysList[nCooSysIndex] );
if( xCooSys == xCurrentCooSys )
{
aRet = ObjectIdentifier::createParticleForDiagram( xDiagram, xChartModel );
aRet = ObjectIdentifier::createParticleForDiagram();
aRet.append(":CS=");
aRet.append( OUString::number( nCooSysIndex ) );
break;
......@@ -649,7 +639,7 @@ OUString ObjectIdentifier::createParticleForLegend( ChartModel& rModel )
Reference< XDiagram > xDiagram( rModel.getFirstDiagram() );
//todo: if more than one diagram is implemeted, find the correct diagram which is owner of the given legend
aRet.append( ObjectIdentifier::createParticleForDiagram( xDiagram, rModel ) );
aRet.append( ObjectIdentifier::createParticleForDiagram() );
aRet.append(":");
aRet.append(getStringForType( OBJECTTYPE_LEGEND ));
aRet.append("=");
......@@ -665,7 +655,7 @@ OUString ObjectIdentifier::createParticleForLegend(
Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
//todo: if more than one diagram is implemeted, find the correct diagram which is owner of the given legend
aRet.append( ObjectIdentifier::createParticleForDiagram( xDiagram, xChartModel ) );
aRet.append( ObjectIdentifier::createParticleForDiagram() );
aRet.append(":");
aRet.append(getStringForType( OBJECTTYPE_LEGEND ));
aRet.append("=");
......
......@@ -347,7 +347,6 @@ void RegressionCurveHelper::removeMeanValueLine(
uno::Reference< chart2::XRegressionCurve > RegressionCurveHelper::addRegressionCurve(
SvxChartRegress eType,
uno::Reference< XRegressionCurveContainer > const & xRegressionCurveContainer,
const uno::Reference< XComponentContext >& /* xContext */,
const uno::Reference< beans::XPropertySet >& xPropertySource,
const uno::Reference< beans::XPropertySet >& xEquationProperties )
{
......@@ -467,14 +466,12 @@ void RegressionCurveHelper::removeEquations(
uno::Reference< XRegressionCurve > RegressionCurveHelper::changeRegressionCurveType(
SvxChartRegress eType,
uno::Reference< XRegressionCurveContainer > const & xRegressionCurveContainer,
uno::Reference< XRegressionCurve > const & xRegressionCurve,
const uno::Reference< XComponentContext > & xContext )
uno::Reference< XRegressionCurve > const & xRegressionCurve )
{
xRegressionCurveContainer->removeRegressionCurve( xRegressionCurve );
return RegressionCurveHelper::addRegressionCurve(
eType,
xRegressionCurveContainer,
xContext,
uno::Reference< beans::XPropertySet >( xRegressionCurve, uno::UNO_QUERY ),
xRegressionCurve->getEquationProperties());
}
......
......@@ -1574,15 +1574,6 @@ bool PieChart::performLabelBestFitInnerPlacement(ShapeParam& rShapeParam, PieLab
return true;
}
/** Handle the outer placement of the labels in the best fit case.
*
*/
bool PieChart::performLabelBestFitOuterPlacement(ShapeParam& /*rShapeParam*/, PieLabelInfo& /*rPieLabelInfo*/)
{
SAL_WARN( "chart2.pie.label.bestfit", "to be implemented" );
return false;
}
/** Handle the placement of the label in the best fit case.
* First off the routine try to place the label inside the related pie slice,
* if this is not possible the label is placed outside.
......@@ -1594,7 +1585,7 @@ void PieChart::performLabelBestFit(ShapeParam& rShapeParam, PieLabelInfo& rPieLa
if( !performLabelBestFitInnerPlacement(rShapeParam, rPieLabelInfo) )
{
performLabelBestFitOuterPlacement(rShapeParam, rPieLabelInfo);
// TODO
}
}
......
......@@ -107,7 +107,6 @@ struct PieLabelInfo;
, const css::awt::Size& rPageSize );
bool performLabelBestFitInnerPlacement(ShapeParam& rShapeParam, PieLabelInfo const & rPieLabelInfo);
static bool performLabelBestFitOuterPlacement(ShapeParam& rShapeParam, PieLabelInfo& rPieLabelInfo);
void performLabelBestFit(ShapeParam& rShapeParam, PieLabelInfo& rPieLabelInfo);
private: //member
......
......@@ -28,9 +28,14 @@ class CheckUnusedParams: public RecursiveASTVisitor<CheckUnusedParams>, public l
public:
explicit CheckUnusedParams(InstantiationData const & data): Plugin(data) {}
void run() override;
bool VisitFunctionDecl(FunctionDecl const * decl);
bool VisitDeclRefExpr(DeclRefExpr const *);
bool VisitFunctionDecl(FunctionDecl const *);
bool VisitUnaryAddrOf(UnaryOperator const *);
bool VisitInitListExpr(InitListExpr const *);
bool VisitCallExpr(CallExpr const *);
bool VisitBinAssign(BinaryOperator const *);
bool VisitCXXConstructExpr(CXXConstructExpr const *);
private:
void checkForFunctionDecl(Expr const *, bool bCheckOnly = false);
std::set<FunctionDecl const *> m_addressOfSet;
enum class PluginPhase { FindAddressOf, Warning };
PluginPhase m_phase;
......@@ -68,20 +73,57 @@ void CheckUnusedParams::run()
TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
}
bool CheckUnusedParams::VisitDeclRefExpr(DeclRefExpr const * declRef) {
bool CheckUnusedParams::VisitUnaryAddrOf(UnaryOperator const * op) {
if (m_phase != PluginPhase::FindAddressOf)
return true;
if (ignoreLocation(declRef))
checkForFunctionDecl(op->getSubExpr());
return true;
}
bool CheckUnusedParams::VisitBinAssign(BinaryOperator const * binaryOperator) {
if (m_phase != PluginPhase::FindAddressOf)
return true;
if (isInUnoIncludeFile(compiler.getSourceManager().getSpellingLoc(declRef->getLocStart())))
checkForFunctionDecl(binaryOperator->getRHS());
return true;
}
bool CheckUnusedParams::VisitCallExpr(CallExpr const * callExpr) {
if (m_phase != PluginPhase::FindAddressOf)
return true;
auto functionDecl = dyn_cast<FunctionDecl>(declRef->getDecl());
if (!functionDecl)
for (auto arg : callExpr->arguments())
checkForFunctionDecl(arg);
return true;
}
bool CheckUnusedParams::VisitCXXConstructExpr(CXXConstructExpr const * constructExpr) {
if (m_phase != PluginPhase::FindAddressOf)
return true;
m_addressOfSet.insert(functionDecl);
for (auto arg : constructExpr->arguments())
checkForFunctionDecl(arg);
return true;
}
bool CheckUnusedParams::VisitInitListExpr(InitListExpr const * initListExpr) {
if (m_phase != PluginPhase::FindAddressOf)
return true;
for (auto subStmt : *initListExpr)
checkForFunctionDecl(dyn_cast<Expr>(subStmt));
return true;
}
void CheckUnusedParams::checkForFunctionDecl(Expr const * expr, bool bCheckOnly) {
auto e1 = expr->IgnoreParenCasts();
auto declRef = dyn_cast<DeclRefExpr>(e1);
if (!declRef)
return;
auto functionDecl = dyn_cast<FunctionDecl>(declRef->getDecl());
if (!functionDecl)
return;
if (bCheckOnly)
parentStmt(expr)->dump();
else
m_addressOfSet.insert(functionDecl->getCanonicalDecl());
}
static int noFieldsInRecord(RecordType const * recordType) {
auto recordDecl = recordType->getDecl();
......@@ -103,7 +145,7 @@ static bool endswith(const std::string& rStr, const char* pSubStr) {
bool CheckUnusedParams::VisitFunctionDecl(FunctionDecl const * decl) {
if (m_phase != PluginPhase::Warning)
return true;
if (m_addressOfSet.find(decl) != m_addressOfSet.end())
if (m_addressOfSet.find(decl->getCanonicalDecl()) != m_addressOfSet.end())
return true;
if (ignoreLocation(decl))
return true;
......@@ -139,7 +181,6 @@ bool CheckUnusedParams::VisitFunctionDecl(FunctionDecl const * decl) {
{
return true;
}
FunctionDecl const * canon = decl->getCanonicalDecl();
std::string fqn = canon->getQualifiedNameAsString(); // because sometimes clang returns nonsense for the filename of canon
if (ignoreLocation(canon))
......@@ -318,7 +359,30 @@ bool CheckUnusedParams::VisitFunctionDecl(FunctionDecl const * decl) {
|| fqn == "DOM::CDocumentBuilder::_getInstance"
|| fqn == "xml_security::serial_number_adapter::create"
|| fqn == "desktop::splash::create" || fqn == "ScannerManager_CreateInstance"
|| fqn == "formula::FormulaOpCodeMapperObj::create")
|| fqn == "formula::FormulaOpCodeMapperObj::create"
|| fqn == "(anonymous namespace)::createInstance"
|| fqn == "x_error_handler"
|| fqn == "warning_func"
|| fqn == "error_func"
|| fqn == "ScaDateAddIn_CreateInstance"
|| fqn == "ScaPricingAddIn_CreateInstance"
|| fqn == "(anonymous namespace)::PDFSigningPKCS7PasswordCallback"
|| fqn == "ContextMenuEventLink"
|| fqn == "DelayedCloseEventLink"
|| fqn == "GDIMetaFile::ImplColMonoFnc"
|| fqn == "vcl::getGlyph0"
|| fqn == "vcl::getGlyph6"
|| fqn == "vcl::getGlyph12"
|| fqn == "setPasswordCallback"
|| fqn == "VCLExceptionSignal_impl"
|| fqn == "getFontTable"
|| fqn == "textconversiondlgs::ChineseTranslation_UnoDialog::create"
|| fqn == "pcr::DefaultHelpProvider::Create"
|| fqn == "pcr::DefaultFormComponentInspectorModel::Create"
|| fqn == "GraphicExportDialog::GraphicExportDialog"
|| fqn == "pcr::ObjectInspectorModel::Create"
|| fqn == "GraphicExportFilter::GraphicExportFilter"
)
return true;
// TODO
if (fqn == "FontSubsetInfo::CreateFontSubsetFromType1")
......@@ -329,7 +393,24 @@ bool CheckUnusedParams::VisitFunctionDecl(FunctionDecl const * decl) {
return true;
// FIXME
if (fqn == "GtkSalDisplay::filterGdkEvent" || fqn == "SvXMLEmbeddedObjectHelper::ImplReadObject"
|| "chart::CachedDataSequence::CachedDataSequence")
|| fqn == "chart::CachedDataSequence::CachedDataSequence")
return true;
// used via macro
if (fqn == "framework::MediaTypeDetectionHelper::MediaTypeDetectionHelper"
|| fqn == "framework::UriAbbreviation::UriAbbreviation"
|| fqn == "framework::DispatchDisabler::DispatchDisabler"
|| fqn == "framework::DispatchRecorderSupplier::DispatchRecorderSupplier")
return true;
// TODO Armin Le Grand is still working on this
if (fqn == "svx::frame::CreateDiagFrameBorderPrimitives"
|| fqn == "svx::frame::CreateBorderPrimitives")
return true;
// marked with a TODO
if (fqn == "pcr::FormLinkDialog::getExistingRelation"
|| fqn == "ooo::vba::DebugHelper::basicexception")
return true;
// macros at work
if (fqn == "msfilter::lcl_PrintDigest")
return true;
// ignore the LINK macros from include/tools/link.hxx
......
......@@ -143,7 +143,7 @@ extern "C" SAL_JNI_EXPORT jlong JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_Nati
}
jint read_from_storage_stream( JNIEnv * env, jobject /*obj_this*/, jstring name, jstring key )
jint read_from_storage_stream( JNIEnv * env, jstring name, jstring key )
{
std::shared_ptr<StreamHelper> pHelper = StorageContainer::getRegisteredStream(env,name,key);
Reference< XInputStream> xIn = pHelper.get() ? pHelper->getInputStream() : Reference< XInputStream>();
......@@ -185,7 +185,7 @@ jint read_from_storage_stream( JNIEnv * env, jobject /*obj_this*/, jstring name,
* Signature: (Ljava/lang/String;Ljava/lang/String;)I
*/
extern "C" SAL_JNI_EXPORT jint JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess_read__Ljava_lang_String_2Ljava_lang_String_2
(JNIEnv* env, jobject obj_this, jstring name, jstring key)
(JNIEnv* env, jobject /*obj_this*/, jstring name, jstring key)
{
#ifdef HSQLDB_DBG