Kaydet (Commit) 1b666235 authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:singlevalfields improve copy constructor check

Change-Id: Id1e7fbecd9e9f816553d2e678c3f1b7890fc4db8
Reviewed-on: https://gerrit.libreoffice.org/47293Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 15d9087f
......@@ -142,7 +142,7 @@ bool SingleValFields::VisitCXXConstructorDecl( const CXXConstructorDecl* decl )
// doesn't count as a write to fields because it's self->self
if (decl->isCopyOrMoveConstructor())
return true;
return true;
for(auto it = decl->init_begin(); it != decl->init_end(); ++it)
{
......@@ -246,9 +246,15 @@ bool SingleValFields::VisitMemberExpr( const MemberExpr* memberExpr )
return true;
const FunctionDecl* parentFunction = getParentFunctionDecl(memberExpr);
const CXXMethodDecl* methodDecl = dyn_cast_or_null<CXXMethodDecl>(parentFunction);
if (methodDecl && (methodDecl->isCopyAssignmentOperator() || methodDecl->isMoveAssignmentOperator()))
return true;
if (parentFunction)
{
auto methodDecl = dyn_cast<CXXMethodDecl>(parentFunction);
if (methodDecl && (methodDecl->isCopyAssignmentOperator() || methodDecl->isMoveAssignmentOperator()))
return true;
auto cxxConstructorDecl = dyn_cast<CXXConstructorDecl>(parentFunction);
if (cxxConstructorDecl && cxxConstructorDecl->isCopyOrMoveConstructor())
return true;
}
// walk up the tree until we find something interesting
const Stmt* child = memberExpr;
......
......@@ -25,6 +25,18 @@ include/svtools/svparser.hxx:74
include/svtools/svparser.hxx:75
SvParser::TokenStackType bTokenHasValue
0
include/tools/multisel.hxx:41
MultiSelection bInverseCur
0
include/unotools/textsearch.hxx:104
utl::SearchParam m_bWordOnly
0
include/unotools/textsearch.hxx:105
utl::SearchParam m_bSrchInSel
0
include/unotools/textsearch.hxx:110
utl::SearchParam nTransliterationFlags
0
include/vcl/filter/pdfdocument.hxx:173
vcl::filter::PDFNameElement m_nLength
0
......@@ -67,9 +79,6 @@ sc/inc/compiler.hxx:108
sc/qa/unit/ucalc.hxx:41
Test::RangeNameDef mnIndex
1
sc/source/ui/inc/undodat.hxx:447
ScUndoDataForm nStartChangeAction
0
sd/inc/sdpptwrp.hxx:42
SdPPTFilter pBas
0
......@@ -109,6 +118,9 @@ sw/inc/pagepreviewlayout.hxx:49
sw/source/core/inc/frmtool.hxx:260
SwBorderAttrs m_bBorderDist
1
sw/source/core/inc/swfont.hxx:170
SwFont m_bURL
0
sw/source/core/inc/UndoSort.hxx:38
SwSortUndoElement::(anonymous union)::(anonymous) nKenn
4294967295
......@@ -133,9 +145,6 @@ sw/source/filter/ww8/ww8par.hxx:651
sw/source/filter/ww8/ww8par.hxx:660
WW8FormulaControl mhpsCheckBox
20
sw/source/uibase/lingu/sdrhhcwrap.hxx:33
SdrHHCWrapper pTextObj
0
vcl/inc/salprn.hxx:41
SalPrinterQueueInfo mnStatus
0
......@@ -169,10 +178,10 @@ vcl/source/filter/jpeg/transupp.h:131
vcl/source/font/font.cxx:539
(anonymous namespace)::WeightSearchEntry weight
5
vcl/source/gdi/pdfwriter_impl.hxx:706
vcl/source/gdi/pdfwriter_impl.hxx:705
vcl::PDFWriterImpl m_nInheritedPageWidth
595
vcl/source/gdi/pdfwriter_impl.hxx:707
vcl/source/gdi/pdfwriter_impl.hxx:706
vcl::PDFWriterImpl m_nInheritedPageHeight
842
writerfilter/source/dmapper/GraphicImport.cxx:223
......
......@@ -38,7 +38,6 @@ private:
sal_Int32 nCurSubSel; // index in aSels of current selected index
sal_Int32 nCurIndex; // current selected entry
sal_Int32 nSelCount; // number of selected indexes
bool bInverseCur;// inverse cursor
bool bCurValid; // are nCurIndex and nCurSubSel valid
TOOLS_DLLPRIVATE void ImplClear();
......
......@@ -101,14 +101,9 @@ private:
sal_uInt32 m_cWildEscChar; // wildcard escape character
bool m_bWordOnly : 1; // used by normal search
bool m_bSrchInSel : 1; // search only in the selection
bool m_bCaseSense : 1;
bool m_bWildMatchSel : 1; // wildcard pattern must match entire selection
// asian flags - used for the transliteration
TransliterationFlags nTransliterationFlags;
public:
SearchParam( const OUString &rText,
SearchType eSrchType,
......@@ -125,14 +120,10 @@ public:
SearchType GetSrchType() const { return m_eSrchType; }
bool IsCaseSensitive() const { return m_bCaseSense; }
bool IsSrchInSelection() const { return m_bSrchInSel; }
bool IsSrchWordOnly() const { return m_bWordOnly; }
bool IsWildMatchSel() const { return m_bWildMatchSel; }
// signed return for API use
sal_Int32 GetWildEscChar() const { return static_cast<sal_Int32>(m_cWildEscChar); }
TransliterationFlags GetTransliterationFlags() const { return nTransliterationFlags; }
};
// For use in SAL_DEBUG etc. Output format not guaranteed to be stable.
......
......@@ -167,7 +167,6 @@ class SW_DLLPUBLIC SwFont
bool m_bPaintBlank :1; // blanks not with DrawRect
bool m_bFontChg :1;
bool m_bOrgChg :1; // nOrgHeight/Ascent are invalid
bool m_bURL :1;
bool m_bGreyWave :1; // for the extended TextInput: gray waveline
public:
......@@ -255,7 +254,6 @@ public:
bool IsMeta() const { return (0 != m_nMetaCount); }
sal_uInt8 &GetInputField() { return m_nInputFieldCount; }
bool IsInputField() const { return (0 != m_nInputFieldCount); }
bool IsURL() const { return m_bURL; }
inline void SetGreyWave( const bool bNew );
bool IsGreyWave() const { return m_bGreyWave; }
bool IsPaintBlank() const { return m_bPaintBlank; }
......
......@@ -907,16 +907,10 @@ SwTextPortion *SwTextFormatter::WhichTextPor( SwTextFormatInfo &rInf ) const
}
if( !pPor )
{
if( !rInf.X() && !m_pCurr->GetPortion() && !m_pCurr->GetLen() && !GetFnt()->IsURL() )
if( !rInf.X() && !m_pCurr->GetPortion() && !m_pCurr->GetLen() )
pPor = m_pCurr;
else
{
pPor = new SwTextPortion;
if ( GetFnt()->IsURL() )
{
pPor->SetWhichPor( POR_URL );
}
}
}
}
}
......
......@@ -398,9 +398,6 @@ void SwTextPainter::DrawTextLine( const SwRect &rPaint, SwSaveClip &rClip,
// reset (for special vertical alignment)
GetInfo().Y( nOldY );
if( GetFnt()->IsURL() && pPor->InTextGrp() )
GetInfo().NotifyURL( *pPor );
bFirst &= !pPor->GetLen();
if( pNext || !pPor->IsMarginPortion() )
pPor->Move( GetInfo() );
......
......@@ -1489,9 +1489,6 @@ void SwTextPainter::PaintMultiPortion( const SwRect &rPaint,
else
pPor->Paint( GetInfo() );
if( GetFnt()->IsURL() && pPor->InTextGrp() )
GetInfo().NotifyURL( *pPor );
bFirst &= !pPor->GetLen();
if( pNext || !pPor->IsMarginPortion() )
pPor->Move( GetInfo() );
......
......@@ -722,7 +722,6 @@ SwFont::SwFont( const SwFont &rFont )
m_bFontChg = rFont.m_bFontChg;
m_bOrgChg = rFont.m_bOrgChg;
m_bPaintBlank = rFont.m_bPaintBlank;
m_bURL = rFont.m_bURL;
m_bGreyWave = rFont.m_bGreyWave;
m_bBlink = rFont.m_bBlink;
}
......@@ -737,7 +736,6 @@ SwFont::SwFont( const SwAttrSet* pAttrSet,
m_nMetaCount = 0;
m_nInputFieldCount = 0;
m_bPaintBlank = false;
m_bURL = false;
m_bGreyWave = false;
m_bBlink = pAttrSet->GetBlink().GetValue();
m_bOrgChg = true;
......@@ -920,7 +918,6 @@ SwFont& SwFont::operator=( const SwFont &rFont )
m_bFontChg = rFont.m_bFontChg;
m_bOrgChg = rFont.m_bOrgChg;
m_bPaintBlank = rFont.m_bPaintBlank;
m_bURL = rFont.m_bURL;
m_bGreyWave = rFont.m_bGreyWave;
m_bBlink = rFont.m_bBlink;
return *this;
......
......@@ -66,7 +66,6 @@ MultiSelection::MultiSelection():
nCurSubSel(0),
nCurIndex(0),
nSelCount(0),
bInverseCur(false),
bCurValid(false)
{
}
......@@ -88,13 +87,11 @@ MultiSelection::MultiSelection( const MultiSelection& rOrig ) :
{
nCurSubSel = rOrig.nCurSubSel;
nCurIndex = rOrig.nCurIndex;
bInverseCur = rOrig.bInverseCur;
}
else
{
nCurSubSel = 0;
nCurIndex = 0;
bInverseCur = false;
}
// copy the sub selections
......@@ -107,7 +104,6 @@ MultiSelection::MultiSelection( const Range& rRange ):
nCurSubSel(0),
nCurIndex(0),
nSelCount(0),
bInverseCur(false),
bCurValid(false)
{
}
......@@ -421,7 +417,6 @@ sal_Int32 MultiSelection::ImplFwdUnselected()
sal_Int32 MultiSelection::FirstSelected()
{
bInverseCur = false;
nCurSubSel = 0;
bCurValid = !aSels.empty();
......@@ -447,24 +442,16 @@ sal_Int32 MultiSelection::NextSelected()
if ( !bCurValid )
return SFX_ENDOFSELECTION;
if ( bInverseCur )
{
++nCurIndex;
return ImplFwdUnselected();
}
else
{
// is the next index in the current sub selection too?
if ( nCurIndex < aSels[ nCurSubSel ]->Max() )
return ++nCurIndex;
// is the next index in the current sub selection too?
if ( nCurIndex < aSels[ nCurSubSel ]->Max() )
return ++nCurIndex;
// are there further sub selections?
if ( ++nCurSubSel < sal_Int32(aSels.size()) )
return nCurIndex = aSels[ nCurSubSel ]->Min();
// are there further sub selections?
if ( ++nCurSubSel < sal_Int32(aSels.size()) )
return nCurIndex = aSels[ nCurSubSel ]->Min();
// we are at the end!
return SFX_ENDOFSELECTION;
}
// we are at the end!
return SFX_ENDOFSELECTION;
}
void MultiSelection::SetTotalRange( const Range& rTotRange )
......
......@@ -53,12 +53,8 @@ SearchParam::SearchParam( const OUString &rText,
m_cWildEscChar = cWildEscChar;
m_bWordOnly = false;
m_bSrchInSel = false;
m_bCaseSense = bCaseSensitive;
m_bWildMatchSel = bWildMatchSel;
nTransliterationFlags = TransliterationFlags::NONE;
}
SearchParam::SearchParam( const SearchParam& rParam )
......@@ -69,12 +65,8 @@ SearchParam::SearchParam( const SearchParam& rParam )
m_cWildEscChar = rParam.m_cWildEscChar;
m_bWordOnly = rParam.m_bWordOnly;
m_bSrchInSel = rParam.m_bSrchInSel;
m_bCaseSense = rParam.m_bCaseSense;
m_bWildMatchSel = rParam.m_bWildMatchSel;
nTransliterationFlags = rParam.nTransliterationFlags;
}
SearchParam::~SearchParam() {}
......@@ -200,16 +192,11 @@ void TextSearch::Init( const SearchParam & rParam,
case SearchParam::SearchType::Regexp:
aSOpt.AlgorithmType2 = SearchAlgorithms2::REGEXP;
aSOpt.algorithmType = SearchAlgorithms_REGEXP;
if( rParam.IsSrchInSelection() )
aSOpt.searchFlag |= SearchFlags::REG_NOT_BEGINOFLINE |
SearchFlags::REG_NOT_ENDOFLINE;
break;
case SearchParam::SearchType::Normal:
aSOpt.AlgorithmType2 = SearchAlgorithms2::ABSOLUTE;
aSOpt.algorithmType = SearchAlgorithms_ABSOLUTE;
if( rParam.IsSrchWordOnly() )
aSOpt.searchFlag |= SearchFlags::NORM_WORD_ONLY;
break;
default:
......@@ -218,7 +205,7 @@ void TextSearch::Init( const SearchParam & rParam,
aSOpt.searchString = rParam.GetSrchStr();
aSOpt.replaceString = rParam.GetReplaceStr();
aSOpt.Locale = rLocale;
aSOpt.transliterateFlags = rParam.GetTransliterationFlags();
aSOpt.transliterateFlags = TransliterationFlags::NONE;
if( !rParam.IsCaseSensitive() )
{
aSOpt.searchFlag |= SearchFlags::ALL_IGNORE_CASE;
......
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