diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-09-21 14:26:56 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-09-21 18:44:29 +0200 |
commit | 4c945b22fc42eb7a52864018cbca88358e71fd4d (patch) | |
tree | 582dad7232dcd43e00029f5573f9896a93c71ca8 /basic/source | |
parent | 893f2128ed451120e41dba1ee4c2f512ec6bb20e (diff) |
new loplugin:methodcycles
look for closed cycles of methods i.e. unused code that would not
otherwise be found by the unusedmethods loplugin
Change-Id: I3fb052132d97aabca573bb8e9fc424201b1e2042
Reviewed-on: https://gerrit.libreoffice.org/60875
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basic/source')
-rw-r--r-- | basic/source/sbx/sbxarray.cxx | 50 | ||||
-rw-r--r-- | basic/source/sbx/sbxcoll.cxx | 13 | ||||
-rw-r--r-- | basic/source/sbx/sbxobj.cxx | 32 |
3 files changed, 0 insertions, 95 deletions
diff --git a/basic/source/sbx/sbxarray.cxx b/basic/source/sbx/sbxarray.cxx index 668b4df03bc5..628c7dc918af 100644 --- a/basic/source/sbx/sbxarray.cxx +++ b/basic/source/sbx/sbxarray.cxx @@ -341,56 +341,6 @@ void SbxArray::Merge( SbxArray* p ) } } -// Search of an element via the user data. If the element is -// object, it will also be scanned. - -SbxVariable* SbxArray::FindUserData( sal_uInt32 nData ) -{ - SbxVariable* p = nullptr; - for (auto& rEntry : mVarEntries) - { - if (!rEntry.mpVar.is()) - continue; - - if (rEntry.mpVar->IsVisible() && rEntry.mpVar->GetUserData() == nData) - { - p = rEntry.mpVar.get(); - p->ResetFlag( SbxFlagBits::ExtFound ); - break; // JSM 1995-10-06 - } - - // Did we have an array/object with extended search? - if (rEntry.mpVar->IsSet(SbxFlagBits::ExtSearch)) - { - switch (rEntry.mpVar->GetClass()) - { - case SbxClassType::Object: - { - // Objects are not allowed to scan their parent. - SbxFlagBits nOld = rEntry.mpVar->GetFlags(); - rEntry.mpVar->ResetFlag(SbxFlagBits::GlobalSearch); - p = static_cast<SbxObject&>(*rEntry.mpVar).FindUserData(nData); - rEntry.mpVar->SetFlags(nOld); - } - break; - case SbxClassType::Array: - // Casting SbxVariable to SbxArray? Really? - p = reinterpret_cast<SbxArray&>(*rEntry.mpVar).FindUserData(nData); - break; - default: - ; - } - - if (p) - { - p->SetFlag(SbxFlagBits::ExtFound); - break; - } - } - } - return p; -} - // Search of an element by his name and type. If an element is an object, // it will also be scanned.. diff --git a/basic/source/sbx/sbxcoll.cxx b/basic/source/sbx/sbxcoll.cxx index a4175c310318..ab69d3e032a6 100644 --- a/basic/source/sbx/sbxcoll.cxx +++ b/basic/source/sbx/sbxcoll.cxx @@ -87,19 +87,6 @@ void SbxCollection::Initialize() p->SetFlag( SbxFlagBits::DontStore ); } -SbxVariable* SbxCollection::FindUserData( sal_uInt32 nData ) -{ - if( GetParameters() ) - { - SbxObject* pObj = static_cast<SbxObject*>(GetObject()); - return pObj ? pObj->FindUserData( nData ) : nullptr; - } - else - { - return SbxObject::FindUserData( nData ); - } -} - SbxVariable* SbxCollection::Find( const OUString& rName, SbxClassType t ) { if( GetParameters() ) diff --git a/basic/source/sbx/sbxobj.cxx b/basic/source/sbx/sbxobj.cxx index a9bee2a803ed..d35b2aa0dc16 100644 --- a/basic/source/sbx/sbxobj.cxx +++ b/basic/source/sbx/sbxobj.cxx @@ -175,38 +175,6 @@ bool SbxObject::IsClass( const OUString& rName ) const return aClassName.equalsIgnoreAsciiCase( rName ); } -SbxVariable* SbxObject::FindUserData( sal_uInt32 nData ) -{ - SbxVariable* pRes = pMethods->FindUserData( nData ); - if( !pRes ) - { - pRes = pProps->FindUserData( nData ); - } - if( !pRes ) - { - pRes = pObjs->FindUserData( nData ); - } - // Search in the parents? - if( !pRes && IsSet( SbxFlagBits::GlobalSearch ) ) - { - SbxObject* pCur = this; - while( !pRes && pCur->pParent ) - { - // I myself was already searched! - SbxFlagBits nOwn = pCur->GetFlags(); - pCur->ResetFlag( SbxFlagBits::ExtSearch ); - // I search already global! - SbxFlagBits nPar = pCur->pParent->GetFlags(); - pCur->pParent->ResetFlag( SbxFlagBits::GlobalSearch ); - pRes = pCur->pParent->FindUserData( nData ); - pCur->SetFlags( nOwn ); - pCur->pParent->SetFlags( nPar ); - pCur = pCur->pParent; - } - } - return pRes; -} - SbxVariable* SbxObject::Find( const OUString& rName, SbxClassType t ) { #ifdef DBG_UTIL |