loplugin:constparams handle constructors

had to change the structure of the plugin considerably, was too messy to
structure it to do the calculations on a per-function basis

Change-Id: I4edee7735f726101105c607368124a08dba21086
Reviewed-on: https://gerrit.libreoffice.org/40516
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
diff --git a/accessibility/inc/extended/accessibleiconchoicectrl.hxx b/accessibility/inc/extended/accessibleiconchoicectrl.hxx
index 3d83f77..b97e5bc 100644
--- a/accessibility/inc/extended/accessibleiconchoicectrl.hxx
+++ b/accessibility/inc/extended/accessibleiconchoicectrl.hxx
@@ -61,7 +61,7 @@ namespace accessibility
            @param  _xParent
                is our parent accessible object
        */
        AccessibleIconChoiceCtrl( SvtIconChoiceCtrl& _rIconCtrl,
        AccessibleIconChoiceCtrl( SvtIconChoiceCtrl const & _rIconCtrl,
                                  const css::uno::Reference< css::accessibility::XAccessible >& _xParent );

        // XTypeProvider
diff --git a/accessibility/inc/extended/accessiblelistbox.hxx b/accessibility/inc/extended/accessiblelistbox.hxx
index 924eb93..374d99a 100644
--- a/accessibility/inc/extended/accessiblelistbox.hxx
+++ b/accessibility/inc/extended/accessiblelistbox.hxx
@@ -74,7 +74,7 @@ namespace accessibility
            @param  _xParent
                is our parent accessible object
        */
        AccessibleListBox( SvTreeListBox& _rListBox,
        AccessibleListBox( SvTreeListBox const & _rListBox,
                           const css::uno::Reference< css::accessibility::XAccessible >& _xParent );

        // XTypeProvider
diff --git a/accessibility/source/extended/accessibleiconchoicectrl.cxx b/accessibility/source/extended/accessibleiconchoicectrl.cxx
index 6a2c779..0f66fbc 100644
--- a/accessibility/source/extended/accessibleiconchoicectrl.cxx
+++ b/accessibility/source/extended/accessibleiconchoicectrl.cxx
@@ -44,7 +44,7 @@ namespace accessibility

    // Ctor() and Dtor()

    AccessibleIconChoiceCtrl::AccessibleIconChoiceCtrl( SvtIconChoiceCtrl& _rIconCtrl, const Reference< XAccessible >& _xParent ) :
    AccessibleIconChoiceCtrl::AccessibleIconChoiceCtrl( SvtIconChoiceCtrl const & _rIconCtrl, const Reference< XAccessible >& _xParent ) :

        VCLXAccessibleComponent( _rIconCtrl.GetWindowPeer() ),
        m_xParent       ( _xParent )
diff --git a/accessibility/source/extended/accessiblelistbox.cxx b/accessibility/source/extended/accessiblelistbox.cxx
index c19499d..8c57658 100644
--- a/accessibility/source/extended/accessiblelistbox.cxx
+++ b/accessibility/source/extended/accessiblelistbox.cxx
@@ -49,7 +49,7 @@ namespace accessibility

    // Ctor() and Dtor()

    AccessibleListBox::AccessibleListBox( SvTreeListBox& _rListBox, const Reference< XAccessible >& _xParent ) :
    AccessibleListBox::AccessibleListBox( SvTreeListBox const & _rListBox, const Reference< XAccessible >& _xParent ) :

        VCLXAccessibleComponent( _rListBox.GetWindowPeer() ),
        m_xParent( _xParent )
diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx
index 9189d75..823e2a0 100644
--- a/basic/source/basmgr/basmgr.cxx
+++ b/basic/source/basmgr/basmgr.cxx
@@ -438,7 +438,7 @@ BasicLibInfo* BasicLibInfo::Create( SotStorageStream& rSStream )
    return pInfo;
}

BasicManager::BasicManager( SotStorage& rStorage, const OUString& rBaseURL, StarBASIC* pParentFromStdLib, OUString* pLibPath, bool bDocMgr ) : mbDocMgr( bDocMgr )
BasicManager::BasicManager( SotStorage& rStorage, const OUString& rBaseURL, StarBASIC* pParentFromStdLib, OUString const * pLibPath, bool bDocMgr ) : mbDocMgr( bDocMgr )
{
    Init();

@@ -604,7 +604,7 @@ void BasicManager::SetLibraryContainerInfo( const LibraryContainerInfo& rInfo )
    SetGlobalUNOConstant( "DialogLibraries", uno::Any( mpImpl->maContainerInfo.mxDialogCont ) );
}

BasicManager::BasicManager( StarBASIC* pSLib, OUString* pLibPath, bool bDocMgr ) : mbDocMgr( bDocMgr )
BasicManager::BasicManager( StarBASIC* pSLib, OUString const * pLibPath, bool bDocMgr ) : mbDocMgr( bDocMgr )
{
    Init();
    DBG_ASSERT( pSLib, "BasicManager cannot be created with a NULL-Pointer!" );
diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx
index 11c2806..ab9a333 100644
--- a/basic/source/runtime/iosys.cxx
+++ b/basic/source/runtime/iosys.cxx
@@ -292,8 +292,8 @@ class UCBStream : public SvStream
    Reference< XStream >        xS;
    Reference< XSeekable >      xSeek;
public:
    explicit UCBStream( Reference< XInputStream > & xIS );
    explicit UCBStream( Reference< XStream > & xS );
    explicit UCBStream( Reference< XInputStream > const & xIS );
    explicit UCBStream( Reference< XStream > const & xS );
                       virtual ~UCBStream() override;
    virtual std::size_t GetData( void* pData, std::size_t nSize ) override;
    virtual std::size_t PutData( const void* pData, std::size_t nSize ) override;
@@ -302,13 +302,13 @@ public:
    virtual void        SetSize( sal_uInt64 nSize ) override;
};

UCBStream::UCBStream( Reference< XInputStream > & rStm )
UCBStream::UCBStream( Reference< XInputStream > const & rStm )
    : xIS( rStm )
    , xSeek( rStm, UNO_QUERY )
{
}

UCBStream::UCBStream( Reference< XStream > & rStm )
UCBStream::UCBStream( Reference< XStream > const & rStm )
    : xS( rStm )
    , xSeek( rStm, UNO_QUERY )
{
diff --git a/comphelper/source/misc/backupfilehelper.cxx b/comphelper/source/misc/backupfilehelper.cxx
index 7f09fb4..ebf93ae 100644
--- a/comphelper/source/misc/backupfilehelper.cxx
+++ b/comphelper/source/misc/backupfilehelper.cxx
@@ -1197,7 +1197,7 @@ namespace
        PackedFileEntry(
            sal_uInt32 nFullFileSize,
            sal_uInt32 nCrc32,
            FileSharedPtr& rFile,
            FileSharedPtr const & rFile,
            bool bDoCompress)
        :   mnFullFileSize(nFullFileSize),
            mnPackFileSize(nFullFileSize),
@@ -1549,7 +1549,7 @@ namespace
            return bRetval;
        }

        bool tryPush(FileSharedPtr& rFileCandidate, bool bCompress)
        bool tryPush(FileSharedPtr const & rFileCandidate, bool bCompress)
        {
            sal_uInt64 nFileSize(0);

diff --git a/compilerplugins/clang/constparams.cxx b/compilerplugins/clang/constparams.cxx
index 76b1b91..93b325a 100644
--- a/compilerplugins/clang/constparams.cxx
+++ b/compilerplugins/clang/constparams.cxx
@@ -8,7 +8,8 @@
 */

#include <string>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <iostream>

#include "plugin.hxx"
@@ -24,6 +25,10 @@
namespace
{

static bool startswith(const std::string& rStr, const char* pSubStr) {
    return rStr.compare(0, strlen(pSubStr), pSubStr) == 0;
}

class ConstParams:
    public RecursiveASTVisitor<ConstParams>, public loplugin::Plugin
{
@@ -31,35 +36,69 @@ public:
    explicit ConstParams(InstantiationData const & data): Plugin(data) {}

    virtual void run() override {
        std::string fn( compiler.getSourceManager().getFileEntryForID(
                        compiler.getSourceManager().getMainFileID())->getName() );
        normalizeDotDotInFilePath(fn);
        if (startswith(fn, SRCDIR "/sal/")
            || startswith(fn, SRCDIR "/bridges/")
            || startswith(fn, SRCDIR "/binaryurp/")
            || startswith(fn, SRCDIR "/stoc/")
            || startswith(fn, WORKDIR "/YaccTarget/unoidl/source/sourceprovider-parser.cxx")
            // some weird calling through a function pointer
            || startswith(fn, SRCDIR "/svtools/source/table/defaultinputhandler.cxx")
            // windows only
            || startswith(fn, SRCDIR "/basic/source/sbx/sbxdec.cxx")
            || startswith(fn, SRCDIR "/sfx2/source/doc/syspath.cxx")
            // ignore this for now
            || startswith(fn, SRCDIR "/libreofficekit")
            )
            return;

        TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());

        for (const ParmVarDecl *pParmVarDecl : interestingSet) {
            if (cannotBeConstSet.find(pParmVarDecl) == cannotBeConstSet.end()) {
                report(
                    DiagnosticsEngine::Warning,
                    "this parameter can be const",
                    pParmVarDecl->getLocStart())
                    << pParmVarDecl->getSourceRange();
                auto functionDecl = parmToFunction[pParmVarDecl];
                if (functionDecl->getCanonicalDecl()->getLocation() != functionDecl->getLocation()) {
                    unsigned idx = pParmVarDecl->getFunctionScopeIndex();
                    const ParmVarDecl* pOther = functionDecl->getCanonicalDecl()->getParamDecl(idx);
                    report(
                        DiagnosticsEngine::Note,
                        "canonical parameter declaration here",
                        pOther->getLocStart())
                        << pOther->getSourceRange();
                }
            }
        }
    }

    bool VisitFunctionDecl(FunctionDecl *);
    bool VisitDeclRefExpr( const DeclRefExpr* );
    bool VisitFunctionDecl(const FunctionDecl *);
    bool VisitDeclRefExpr(const DeclRefExpr *);

private:
    bool checkIfCanBeConst(const Stmt*, const ParmVarDecl*);
    bool isPointerOrReferenceToConst(const QualType& qt);
    StringRef getFilename(const SourceLocation& loc);

    bool mbInsideFunction;
    std::set<const ParmVarDecl*> interestingSet;
    std::set<const ParmVarDecl*> cannotBeConstSet;
    std::unordered_set<const ParmVarDecl*> interestingSet;
    std::unordered_map<const ParmVarDecl*, const FunctionDecl*> parmToFunction;
    std::unordered_set<const ParmVarDecl*> cannotBeConstSet;
};

bool ConstParams::VisitFunctionDecl(FunctionDecl * functionDecl)
bool ConstParams::VisitFunctionDecl(const FunctionDecl * functionDecl)
{
    if (ignoreLocation(functionDecl) || !functionDecl->doesThisDeclarationHaveABody()) {
    if (ignoreLocation(functionDecl) || !functionDecl->isThisDeclarationADefinition()) {
        return true;
    }
    // ignore stuff that forms part of the stable URE interface
    if (isInUnoIncludeFile(functionDecl)) {
        return true;
    }
    // TODO ignore these for now, requires some extra work
    if (isa<CXXConstructorDecl>(functionDecl)) {
        return true;
    }
    // TODO ignore template stuff for now
    if (functionDecl->getTemplatedKind() != FunctionDecl::TK_NonTemplate) {
        return true;
@@ -82,11 +121,12 @@ bool ConstParams::VisitFunctionDecl(FunctionDecl * functionDecl)
    if (functionDecl->getLocation().isMacroID())
        return true;

    if (functionDecl->getIdentifier()) {
    if (functionDecl->getIdentifier())
    {
        StringRef name = functionDecl->getName();
        if (name == "yyerror" // ignore lex/yacc callback
                // some function callbacks
                // TODO should really use a two-pass algorithm to detect and ignore these automatically
                    // some function callbacks
                    // TODO should really use a two-pass algorithm to detect and ignore these automatically
            || name == "PDFSigningPKCS7PasswordCallback"
            || name == "VCLExceptionSignal_impl"
            || name == "parseXcsFile"
@@ -114,6 +154,7 @@ bool ConstParams::VisitFunctionDecl(FunctionDecl * functionDecl)
            || name == "ImpGetEscDir"
            || name == "ImpGetPercent"
            || name == "ImpGetAlign"
            || name == "write_function"
             // #ifdef win32
            || name == "convert_slashes"
                // UNO component entry points
@@ -129,22 +170,7 @@ bool ConstParams::VisitFunctionDecl(FunctionDecl * functionDecl)
                return true;
    }

    StringRef aFileName = getFilename(functionDecl->getLocStart());
    if (loplugin::hasPathnamePrefix(aFileName, SRCDIR "/sal/")
        || loplugin::hasPathnamePrefix(aFileName, SRCDIR "/bridges/")
        || loplugin::hasPathnamePrefix(aFileName, SRCDIR "/binaryurp/")
        || loplugin::hasPathnamePrefix(aFileName, SRCDIR "/stoc/")
        || loplugin::hasPathnamePrefix(aFileName, WORKDIR "/YaccTarget/unoidl/source/sourceprovider-parser.cxx")
        // some weird calling through a function pointer
        || loplugin::hasPathnamePrefix(aFileName, SRCDIR "/svtools/source/table/defaultinputhandler.cxx")
        // windows only
        || loplugin::hasPathnamePrefix(aFileName, SRCDIR "/basic/source/sbx/sbxdec.cxx")
        || loplugin::hasPathnamePrefix(aFileName, SRCDIR "/sfx2/source/doc/syspath.cxx")) {
        return true;
    }

    // calculate the ones we want to check
    interestingSet.clear();
    for (const ParmVarDecl *pParmVarDecl : compat::parameters(*functionDecl)) {
        // ignore unused params
        if (pParmVarDecl->getName().empty())
@@ -165,50 +191,29 @@ bool ConstParams::VisitFunctionDecl(FunctionDecl * functionDecl)
        // const is meaningless when applied to function pointer types
        if (pParmVarDecl->getType()->isFunctionPointerType())
            continue;
        // ignore things with template params
        if (pParmVarDecl->getType()->isInstantiationDependentType())
            continue;
        interestingSet.insert(pParmVarDecl);
    }
    if (interestingSet.empty()) {
        return true;
        parmToFunction[pParmVarDecl] = functionDecl;
    }

    mbInsideFunction = true;
    cannotBeConstSet.clear();
    bool ret = RecursiveASTVisitor::TraverseStmt(functionDecl->getBody());
    mbInsideFunction = false;

    for (const ParmVarDecl *pParmVarDecl : interestingSet) {
        if (cannotBeConstSet.find(pParmVarDecl) == cannotBeConstSet.end()) {
            report(
                DiagnosticsEngine::Warning,
                "this parameter can be const",
                pParmVarDecl->getLocStart())
                << pParmVarDecl->getSourceRange();
            if (functionDecl->getCanonicalDecl()->getLocation() != functionDecl->getLocation()) {
                unsigned idx = pParmVarDecl->getFunctionScopeIndex();
                ParmVarDecl* pOther = functionDecl->getCanonicalDecl()->getParamDecl(idx);
                report(
                    DiagnosticsEngine::Note,
                    "canonical parameter declaration here",
                    pOther->getLocStart())
                    << pOther->getSourceRange();
            }
        }
    }
    return ret;
    return true;
}

bool ConstParams::VisitDeclRefExpr( const DeclRefExpr* declRefExpr )
{
    if (!mbInsideFunction) {
    if (ignoreLocation(declRefExpr)) {
        return true;
    }
    // ignore stuff that forms part of the stable URE interface
    if (isInUnoIncludeFile(declRefExpr->getLocStart())) {
        return true;
    }
    const ParmVarDecl* parmVarDecl = dyn_cast_or_null<ParmVarDecl>(declRefExpr->getDecl());
    if (!parmVarDecl) {
        return true;
    }
    if (interestingSet.find(parmVarDecl) == interestingSet.end()) {
        return true;
    }
    // no need to check again if we have already eliminated this one
    if (cannotBeConstSet.find(parmVarDecl) != cannotBeConstSet.end())
        return true;
@@ -218,13 +223,41 @@ bool ConstParams::VisitDeclRefExpr( const DeclRefExpr* declRefExpr )
    return true;
}

// Walk up from a DeclRefExpr to a ParamVarDecl, checking if the usage means that the
// ParamVarDecl can be const.
// Walk up from a statement that contains a DeclRefExpr, checking if the usage means that the
// related ParamVarDecl can be const.
bool ConstParams::checkIfCanBeConst(const Stmt* stmt, const ParmVarDecl* parmVarDecl)
{
    const Stmt* parent = parentStmt( stmt );
    if (isa<UnaryOperator>(parent)) {
        const UnaryOperator* unaryOperator = dyn_cast<UnaryOperator>(parent);
    if (!parent)
    {
        // check if we're inside a CXXCtorInitializer
        auto parentsRange = compiler.getASTContext().getParents(*stmt);
        if ( parentsRange.begin() == parentsRange.end())
            return true;
        auto cxxConstructorDecl = dyn_cast_or_null<CXXConstructorDecl>(parentsRange.begin()->get<Decl>());
        if (!cxxConstructorDecl)
            return true;
        for ( auto cxxCtorInitializer : cxxConstructorDecl->inits())
        {
            if (cxxCtorInitializer->isAnyMemberInitializer() && cxxCtorInitializer->getInit() == stmt)
            {
                // if the member is not pointer or ref to-const, we cannot make the param const
                auto fieldDecl = cxxCtorInitializer->getAnyMember();
                auto tc = loplugin::TypeCheck(fieldDecl->getType());
                return tc.Pointer().Const() || tc.LvalueReference().Const();
            }
        }
        parmVarDecl->dump();
        stmt->dump();
        cxxConstructorDecl->dump();
        report(
             DiagnosticsEngine::Warning,
             "couldn't find the CXXCtorInitializer?",
              stmt->getLocStart())
              << stmt->getSourceRange();
        return false;
    }
    if (auto unaryOperator = dyn_cast<UnaryOperator>(parent)) {
        UnaryOperator::Opcode op = unaryOperator->getOpcode();
        if (op == UO_AddrOf || op == UO_PreInc || op == UO_PostInc
            || op == UO_PreDec || op == UO_PostDec) {
@@ -254,17 +287,15 @@ bool ConstParams::checkIfCanBeConst(const Stmt* stmt, const ParmVarDecl* parmVar
            return checkIfCanBeConst(parent, parmVarDecl);
        }
        return true;
    } else if (isa<CXXConstructExpr>(parent)) {
        const CXXConstructExpr* constructExpr = dyn_cast<CXXConstructExpr>(parent);
    } else if (auto constructExpr = dyn_cast<CXXConstructExpr>(parent)) {
        const CXXConstructorDecl * constructorDecl = constructExpr->getConstructor();
        for (unsigned i = 0; i < constructExpr->getNumArgs(); ++i) {
            if (constructExpr->getArg(i) == stmt) {
                return isPointerOrReferenceToConst(constructorDecl->getParamDecl(i)->getType());
            }
        }
    } else if (isa<CXXOperatorCallExpr>(parent)) {
        const CXXOperatorCallExpr* operatorCallExpr = dyn_cast<CXXOperatorCallExpr>(parent);
        const CXXMethodDecl* calleeMethodDecl = dyn_cast<CXXMethodDecl>(operatorCallExpr->getDirectCallee());
    } else if (auto operatorCallExpr = dyn_cast<CXXOperatorCallExpr>(parent)) {
        const CXXMethodDecl* calleeMethodDecl = dyn_cast_or_null<CXXMethodDecl>(operatorCallExpr->getDirectCallee());
        if (calleeMethodDecl) {
            // unary operator
            if (calleeMethodDecl->getNumParams() == 0) {
@@ -293,8 +324,7 @@ bool ConstParams::checkIfCanBeConst(const Stmt* stmt, const ParmVarDecl* parmVar
                }
            }
        }
    } else if (isa<CallExpr>(parent)) {
        const CallExpr* callExpr = dyn_cast<CallExpr>(parent);
    } else if (auto callExpr = dyn_cast<CallExpr>(parent)) {
        QualType functionType = callExpr->getCallee()->getType();
        if (functionType->isFunctionPointerType()) {
            functionType = functionType->getPointeeType();
@@ -314,27 +344,29 @@ bool ConstParams::checkIfCanBeConst(const Stmt* stmt, const ParmVarDecl* parmVar
            }
        }
        const FunctionDecl* calleeFunctionDecl = callExpr->getDirectCallee();
        if (isa<CXXMemberCallExpr>(parent)) {
            const CXXMemberCallExpr* memberCallExpr = dyn_cast<CXXMemberCallExpr>(parent);
            const MemberExpr* memberExpr = dyn_cast<MemberExpr>(stmt);
            if (memberExpr && memberCallExpr->getImplicitObjectArgument() == memberExpr->getBase())
            {
                const CXXMethodDecl* calleeMethodDecl = dyn_cast<CXXMethodDecl>(calleeFunctionDecl);
                return calleeMethodDecl->isConst();
        if (calleeFunctionDecl)
        {
            if (auto memberCallExpr = dyn_cast<CXXMemberCallExpr>(parent)) {
                const MemberExpr* memberExpr = dyn_cast<MemberExpr>(stmt);
                if (memberExpr && memberCallExpr->getImplicitObjectArgument() == memberExpr->getBase())
                {
                    const CXXMethodDecl* calleeMethodDecl = dyn_cast<CXXMethodDecl>(calleeFunctionDecl);
                    return calleeMethodDecl->isConst();
                }
            }
        }
        // TODO could do better
        if (calleeFunctionDecl->isVariadic()) {
            return false;
        }
        if (callExpr->getCallee() == stmt) {
            return true;
        }
        for (unsigned i = 0; i < callExpr->getNumArgs(); ++i) {
            if (i >= calleeFunctionDecl->getNumParams()) // can happen in template code
                break;
            if (callExpr->getArg(i) == stmt) {
                return isPointerOrReferenceToConst(calleeFunctionDecl->getParamDecl(i)->getType());
            // TODO could do better
            if (calleeFunctionDecl->isVariadic()) {
                return false;
            }
            if (callExpr->getCallee() == stmt) {
                return true;
            }
            for (unsigned i = 0; i < callExpr->getNumArgs(); ++i) {
                if (i >= calleeFunctionDecl->getNumParams()) // can happen in template code
                    break;
                if (callExpr->getArg(i) == stmt) {
                    return isPointerOrReferenceToConst(calleeFunctionDecl->getParamDecl(i)->getType());
                }
            }
        }
    } else if (isa<CXXReinterpretCastExpr>(parent)) {
@@ -370,15 +402,20 @@ bool ConstParams::checkIfCanBeConst(const Stmt* stmt, const ParmVarDecl* parmVar
        return false;
    } else if (isa<VAArgExpr>(parent)) {
        return false;
    } else if (isa<CXXDependentScopeMemberExpr>(parent)) {
        return false;
    } else if (isa<MaterializeTemporaryExpr>(parent)) {
        return true;
    } else if (const ConditionalOperator* conditionalExpr = dyn_cast<ConditionalOperator>(parent)) {
    } else if (auto conditionalExpr = dyn_cast<ConditionalOperator>(parent)) {
        if (conditionalExpr->getCond() == stmt)
            return true;
        return checkIfCanBeConst(parent, parmVarDecl);
    } else if (isa<UnaryExprOrTypeTraitExpr>(parent)) {
        return false; // ???
    } else if (isa<CXXNewExpr>(parent)) {
    } else if (auto cxxNewExpr = dyn_cast<CXXNewExpr>(parent)) {
        for (auto pa : cxxNewExpr->placement_arguments())
            if (pa == stmt)
                return false;
        return true; // because the ParamVarDecl must be a parameter to the expression, probably an array length
    } else if (auto lambdaExpr = dyn_cast<LambdaExpr>(parent)) {
        for (auto it = lambdaExpr->capture_begin(); it != lambdaExpr->capture_end(); ++it)
@@ -386,18 +423,21 @@ bool ConstParams::checkIfCanBeConst(const Stmt* stmt, const ParmVarDecl* parmVar
            if (it->capturesVariable() && it->getCapturedVar() == parmVarDecl)
                return it->getCaptureKind() != LCK_ByRef;
        }
        /* sigh. just running this message will cause clang to crash (in sdext)
        report(
             DiagnosticsEngine::Warning,
             "cannot handle this lambda",
              parent->getLocStart())
              << parent->getSourceRange();
        parent->dump();
        parmVarDecl->dump();
         */
         return false;
        return false;
    } else if (isa<CXXTypeidExpr>(parent)) {
        return true;
    } else if (isa<ParenListExpr>(parent)) {
        return true;
    } else if (isa<CXXUnresolvedConstructExpr>(parent)) {
        return false;
    } else if (isa<UnresolvedMemberExpr>(parent)) {
        return false;
    } else if (isa<PackExpansionExpr>(parent)) {
        return false;
    } else if (isa<ExprWithCleanups>(parent)) {
        return checkIfCanBeConst(parent, parmVarDecl);
    } else if (isa<CaseStmt>(parent)) {
        return true;
    } else {
        parent->dump();
        parmVarDecl->dump();
diff --git a/compilerplugins/clang/test/constparams.cxx b/compilerplugins/clang/test/constparams.cxx
new file mode 100644
index 0000000..fd4ee2c
--- /dev/null
+++ b/compilerplugins/clang/test/constparams.cxx
@@ -0,0 +1,27 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

struct Class1
{
    int const * m_f1;
    Class1(int * f1) : m_f1(f1) {} // expected-error {{this parameter can be const [loplugin:constparams]}}
};

struct Class2
{
    int * m_f2;
    Class2(int * f2) : m_f2(f2) {}
};
struct Class3
{
    int * m_f2;
    Class3(void * f2) : m_f2(static_cast<int*>(f2)) {}
};

/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/file/fcode.cxx b/connectivity/source/drivers/file/fcode.cxx
index 69b1692..6e3e294 100644
--- a/connectivity/source/drivers/file/fcode.cxx
+++ b/connectivity/source/drivers/file/fcode.cxx
@@ -65,7 +65,7 @@ void OOperandValue::setValue(const ORowSetValue& _rVal)
    m_aValue = _rVal;
}

OOperandParam::OOperandParam(OSQLParseNode* pNode, sal_Int32 _nPos)
OOperandParam::OOperandParam(OSQLParseNode const * pNode, sal_Int32 _nPos)
    : OOperandRow(static_cast<sal_uInt16>(_nPos), DataType::VARCHAR)         // Standard-Type
{
    OSL_ENSURE(SQL_ISRULE(pNode,parameter),"Argument is not a parameter");
diff --git a/connectivity/source/drivers/file/fcomp.cxx b/connectivity/source/drivers/file/fcomp.cxx
index d922a52..1953fb53 100644
--- a/connectivity/source/drivers/file/fcomp.cxx
+++ b/connectivity/source/drivers/file/fcomp.cxx
@@ -134,7 +134,7 @@ void OPredicateCompiler::start(OSQLParseNode const * pSQLParseNode)
}


OOperand* OPredicateCompiler::execute(OSQLParseNode* pPredicateNode)
OOperand* OPredicateCompiler::execute(OSQLParseNode const * pPredicateNode)
{
    OOperand* pOperand = nullptr;
    if (pPredicateNode->count() == 3 &&                         // Expression is bracketed
@@ -408,7 +408,7 @@ void OPredicateCompiler::execute_ISNULL(OSQLParseNode const * pPredicateNode)
    m_aCodeList.push_back(pOperator);
}

OOperand* OPredicateCompiler::execute_Operand(OSQLParseNode* pPredicateNode)
OOperand* OPredicateCompiler::execute_Operand(OSQLParseNode const * pPredicateNode)
{
    OOperand* pOperand = nullptr;

diff --git a/connectivity/source/drivers/firebird/Blob.cxx b/connectivity/source/drivers/firebird/Blob.cxx
index be4922d..b71c884 100644
--- a/connectivity/source/drivers/firebird/Blob.cxx
+++ b/connectivity/source/drivers/firebird/Blob.cxx
@@ -31,7 +31,7 @@ using namespace ::com::sun::star::uno;

Blob::Blob(isc_db_handle* pDatabaseHandle,
           isc_tr_handle* pTransactionHandle,
           ISC_QUAD& aBlobID):
           ISC_QUAD const & aBlobID):
    Blob_BASE(m_aMutex),
    m_pDatabaseHandle(pDatabaseHandle),
    m_pTransactionHandle(pTransactionHandle),
diff --git a/connectivity/source/drivers/firebird/Blob.hxx b/connectivity/source/drivers/firebird/Blob.hxx
index eb8e282..9afa09d 100644
--- a/connectivity/source/drivers/firebird/Blob.hxx
+++ b/connectivity/source/drivers/firebird/Blob.hxx
@@ -58,7 +58,7 @@ namespace connectivity
        public:
            Blob(isc_db_handle* pDatabaseHandle,
                 isc_tr_handle* pTransactionHandle,
                 ISC_QUAD& aBlobID);
                 ISC_QUAD const & aBlobID);

            // ---- XBlob ----------------------------------------------------
            virtual sal_Int64 SAL_CALL
diff --git a/connectivity/source/drivers/firebird/Clob.cxx b/connectivity/source/drivers/firebird/Clob.cxx
index 4f70a00..7e2d497 100644
--- a/connectivity/source/drivers/firebird/Clob.cxx
+++ b/connectivity/source/drivers/firebird/Clob.cxx
@@ -26,7 +26,7 @@ using namespace ::com::sun::star::uno;

Clob::Clob(isc_db_handle* pDatabaseHandle,
           isc_tr_handle* pTransactionHandle,
           ISC_QUAD& aBlobID):
           ISC_QUAD const & aBlobID):
    Clob_BASE(m_aMutex),
    m_aBlob(new connectivity::firebird::Blob(pDatabaseHandle, pTransactionHandle, aBlobID))
{
diff --git a/connectivity/source/drivers/firebird/Clob.hxx b/connectivity/source/drivers/firebird/Clob.hxx
index b71bec1..d435312 100644
--- a/connectivity/source/drivers/firebird/Clob.hxx
+++ b/connectivity/source/drivers/firebird/Clob.hxx
@@ -41,7 +41,7 @@ namespace connectivity
        public:
            Clob(isc_db_handle* pDatabaseHandle,
                 isc_tr_handle* pTransactionHandle,
                 ISC_QUAD& aBlobID);
                 ISC_QUAD const & aBlobID);

            // ---- XClob ----------------------------------------------------
            virtual sal_Int64 SAL_CALL
diff --git a/connectivity/source/drivers/firebird/Connection.cxx b/connectivity/source/drivers/firebird/Connection.cxx
index f6807cf..d792ecb 100644
--- a/connectivity/source/drivers/firebird/Connection.cxx
+++ b/connectivity/source/drivers/firebird/Connection.cxx
@@ -349,7 +349,7 @@ void Connection::notifyDatabaseModified()
IMPLEMENT_SERVICE_INFO(Connection, "com.sun.star.sdbc.drivers.firebird.Connection",
                                                    "com.sun.star.sdbc.Connection")

Reference< XBlob> Connection::createBlob(ISC_QUAD* pBlobId)
Reference< XBlob> Connection::createBlob(ISC_QUAD const * pBlobId)
{
    MutexGuard aGuard(m_aMutex);
    checkDisposed(Connection_BASE::rBHelper.bDisposed);
@@ -362,7 +362,7 @@ Reference< XBlob> Connection::createBlob(ISC_QUAD* pBlobId)
    return xReturn;
}

Reference< XClob> Connection::createClob(ISC_QUAD* pBlobId)
Reference< XClob> Connection::createClob(ISC_QUAD const * pBlobId)
{
    MutexGuard aGuard(m_aMutex);
    checkDisposed(Connection_BASE::rBHelper.bDisposed);
diff --git a/connectivity/source/drivers/firebird/Connection.hxx b/connectivity/source/drivers/firebird/Connection.hxx
index 43bccf9..70f5a41 100644
--- a/connectivity/source/drivers/firebird/Connection.hxx
+++ b/connectivity/source/drivers/firebird/Connection.hxx
@@ -211,11 +211,11 @@ namespace connectivity
             * @throws css::uno::RuntimeException
             */
            css::uno::Reference< css::sdbc::XBlob>
                createBlob(ISC_QUAD* pBlobID);
                createBlob(ISC_QUAD const * pBlobID);
            /// @throws css::sdbc::SQLException
            /// @throws css::uno::RuntimeException
            css::uno::Reference< css::sdbc::XClob>
                createClob(ISC_QUAD* pBlobID);
                createClob(ISC_QUAD const * pBlobID);

            /**
             * Create and/or connect to the sdbcx Catalog. This is completely
diff --git a/connectivity/source/drivers/firebird/Tables.hxx b/connectivity/source/drivers/firebird/Tables.hxx
index e106b8b..d391ca8 100644
--- a/connectivity/source/drivers/firebird/Tables.hxx
+++ b/connectivity/source/drivers/firebird/Tables.hxx
@@ -45,7 +45,7 @@ namespace connectivity
            Tables(const css::uno::Reference< css::sdbc::XDatabaseMetaData >& rMetaData,
                   ::cppu::OWeakObject& rParent,
                   ::osl::Mutex& rMutex,
                   ::connectivity::TStringVector& rNames) : sdbcx::OCollection(rParent, true, rMutex, rNames), m_xMetaData(rMetaData) {}
                   ::connectivity::TStringVector const & rNames) : sdbcx::OCollection(rParent, true, rMutex, rNames), m_xMetaData(rMetaData) {}

            // TODO: we should also implement XDataDescriptorFactory, XRefreshable,
            // XAppend,  etc., but all are optional.
diff --git a/connectivity/source/drivers/firebird/Users.cxx b/connectivity/source/drivers/firebird/Users.cxx
index a887a67..edaa9ed 100644
--- a/connectivity/source/drivers/firebird/Users.cxx
+++ b/connectivity/source/drivers/firebird/Users.cxx
@@ -30,7 +30,7 @@ using namespace ::com::sun::star::uno;
Users::Users(const uno::Reference< XDatabaseMetaData >& rMetaData,
             OWeakObject& rParent,
             Mutex& rMutex,
             TStringVector& rNames) :
             TStringVector const & rNames) :
    OCollection(rParent,
                true,
                rMutex,
diff --git a/connectivity/source/drivers/firebird/Users.hxx b/connectivity/source/drivers/firebird/Users.hxx
index 75ba144..a689e67 100644
--- a/connectivity/source/drivers/firebird/Users.hxx
+++ b/connectivity/source/drivers/firebird/Users.hxx
@@ -42,7 +42,7 @@ namespace connectivity
            Users(const css::uno::Reference< css::sdbc::XDatabaseMetaData >& rMetaData,
                  ::cppu::OWeakObject& rParent,
                  ::osl::Mutex& rMutex,
                  ::connectivity::TStringVector& rNames);
                  ::connectivity::TStringVector const & rNames);

            // TODO: we should also implement XDataDescriptorFactory, XRefreshable,
            // XAppend,  etc., but all are optional.
diff --git a/connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx b/connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx
index 6b46bd2..0634180 100644
--- a/connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx
+++ b/connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx
@@ -117,7 +117,7 @@ ResultSetMetaData::ResultSetMetaData(
    const css::uno::Reference< css::sdbc::XResultSet >  & origin,
    ResultSet * pResultSet,
    ConnectionSettings **ppSettings,
    PGresult *pResult,
    PGresult const *pResult,
    const OUString &schemaName,
    const OUString &tableName ) :
    m_xMutex( refMutex ),
diff --git a/connectivity/source/drivers/postgresql/pq_resultsetmetadata.hxx b/connectivity/source/drivers/postgresql/pq_resultsetmetadata.hxx
index 1beede2..2c1b5e5 100644
--- a/connectivity/source/drivers/postgresql/pq_resultsetmetadata.hxx
+++ b/connectivity/source/drivers/postgresql/pq_resultsetmetadata.hxx
@@ -94,7 +94,7 @@ public:
        const css::uno::Reference< css::sdbc::XResultSet >  & origin,
        ResultSet *pResultSet,
        ConnectionSettings **pSettings,
        PGresult *pResult,
        PGresult const *pResult,
        const OUString &schemaName,
        const OUString &tableName );

diff --git a/connectivity/source/inc/file/fcode.hxx b/connectivity/source/inc/file/fcode.hxx
index 8ac3676..40e0a11 100644
--- a/connectivity/source/inc/file/fcode.hxx
+++ b/connectivity/source/inc/file/fcode.hxx
@@ -110,7 +110,7 @@ namespace connectivity
        class OOperandParam : public OOperandRow
        {
        public:
            OOperandParam(connectivity::OSQLParseNode* pNode, sal_Int32 _nPos);
            OOperandParam(connectivity::OSQLParseNode const * pNode, sal_Int32 _nPos);
        };

        // Value operands
diff --git a/connectivity/source/inc/file/fcomp.hxx b/connectivity/source/inc/file/fcomp.hxx
index 0e86060..a20ce87 100644
--- a/connectivity/source/inc/file/fcomp.hxx
+++ b/connectivity/source/inc/file/fcomp.hxx
@@ -59,7 +59,7 @@ namespace connectivity
            void dispose();

            void start(connectivity::OSQLParseNode const * pSQLParseNode);
            OOperand* execute(connectivity::OSQLParseNode* pPredicateNode);
            OOperand* execute(connectivity::OSQLParseNode const * pPredicateNode);

            void Clean();
            bool isClean() const {return m_aCodeList.empty();}
@@ -81,7 +81,7 @@ namespace connectivity
            void execute_ISNULL(connectivity::OSQLParseNode const * pPredicateNode);
            /// @throws css::sdbc::SQLException
            /// @throws css::uno::RuntimeException
            OOperand* execute_Operand(connectivity::OSQLParseNode* pPredicateNode);
            OOperand* execute_Operand(connectivity::OSQLParseNode const * pPredicateNode);
            /// @throws css::sdbc::SQLException
            /// @throws css::uno::RuntimeException
            void execute_Fold(OSQLParseNode const * pPredicateNode);
diff --git a/cppcanvas/source/mtfrenderer/textaction.cxx b/cppcanvas/source/mtfrenderer/textaction.cxx
index 312550e..cdf90ef 100644
--- a/cppcanvas/source/mtfrenderer/textaction.cxx
+++ b/cppcanvas/source/mtfrenderer/textaction.cxx
@@ -769,7 +769,7 @@ namespace cppcanvas
                                  const OUString&     rText,
                                  sal_Int32                  nStartPos,
                                  sal_Int32                  nLen,
                                  VirtualDevice&             rVDev,
                                  VirtualDevice const &      rVDev,
                                  const CanvasSharedPtr&     rCanvas,
                                  const OutDevState&         rState );

@@ -781,7 +781,7 @@ namespace cppcanvas
                                  const OUString&            rText,
                                  sal_Int32                         nStartPos,
                                  sal_Int32                         nLen,
                                  VirtualDevice&                    rVDev,
                                  VirtualDevice const &             rVDev,
                                  const CanvasSharedPtr&            rCanvas,
                                  const OutDevState&                rState,
                                  const ::basegfx::B2DHomMatrix&    rTextTransform );
@@ -833,7 +833,7 @@ namespace cppcanvas
                                                const OUString&     rText,
                                                sal_Int32                  nStartPos,
                                                sal_Int32                  nLen,
                                                VirtualDevice&             rVDev,
                                                VirtualDevice const &      rVDev,
                                                const CanvasSharedPtr&     rCanvas,
                                                const OutDevState&         rState ) :
                mxFont( rState.xFont ),
@@ -872,7 +872,7 @@ namespace cppcanvas
                                                const OUString&          rText,
                                                sal_Int32                       nStartPos,
                                                sal_Int32                       nLen,
                                                VirtualDevice&                  rVDev,
                                                VirtualDevice const &           rVDev,
                                                const CanvasSharedPtr&          rCanvas,
                                                const OutDevState&              rState,
                                                const ::basegfx::B2DHomMatrix&  rTextTransform ) :
@@ -1190,7 +1190,7 @@ namespace cppcanvas
                                       sal_Int32                        nStartPos,
                                       sal_Int32                        nLen,
                                       const uno::Sequence< double >&   rOffsets,
                                       VirtualDevice&                   rVDev,
                                       VirtualDevice const &            rVDev,
                                       const CanvasSharedPtr&           rCanvas,
                                       const OutDevState&               rState  );
                EffectTextArrayAction( const ::basegfx::B2DPoint&       rStartPoint,
@@ -1202,7 +1202,7 @@ namespace cppcanvas
                                       sal_Int32                        nStartPos,
                                       sal_Int32                        nLen,
                                       const uno::Sequence< double >&   rOffsets,
                                       VirtualDevice&                   rVDev,
                                       VirtualDevice const &            rVDev,
                                       const CanvasSharedPtr&           rCanvas,
                                       const OutDevState&               rState,
                                       const ::basegfx::B2DHomMatrix&   rTextTransform );
@@ -1252,7 +1252,7 @@ namespace cppcanvas
                                                          sal_Int32                         nStartPos,
                                                          sal_Int32                         nLen,
                                                          const uno::Sequence< double >&    rOffsets,
                                                          VirtualDevice&                    rVDev,
                                                          VirtualDevice const &             rVDev,
                                                          const CanvasSharedPtr&            rCanvas,
                                                          const OutDevState&                rState  ) :
                mxTextLayout(),
@@ -1292,7 +1292,7 @@ namespace cppcanvas
                                                          sal_Int32                         nStartPos,
                                                          sal_Int32                         nLen,
                                                          const uno::Sequence< double >&    rOffsets,
                                                          VirtualDevice&                    rVDev,
                                                          VirtualDevice const &             rVDev,
                                                          const CanvasSharedPtr&            rCanvas,
                                                          const OutDevState&                rState,
                                                          const ::basegfx::B2DHomMatrix&    rTextTransform ) :
@@ -1527,7 +1527,7 @@ namespace cppcanvas
                               const ::basegfx::B2DRectangle&                       rOutlineBounds,
                               const uno::Reference< rendering::XPolyPolygon2D >&   rTextPoly,
                               const uno::Sequence< double >&                       rOffsets,
                               VirtualDevice&                                       rVDev,
                               VirtualDevice const &                                rVDev,
                               const CanvasSharedPtr&                               rCanvas,
                               const OutDevState&                                   rState  );
                OutlineAction( const ::basegfx::B2DPoint&                           rStartPoint,
@@ -1538,7 +1538,7 @@ namespace cppcanvas
                               const ::basegfx::B2DRectangle&                       rOutlineBounds,
                               const uno::Reference< rendering::XPolyPolygon2D >&   rTextPoly,
                               const uno::Sequence< double >&                       rOffsets,
                               VirtualDevice&                                       rVDev,
                               VirtualDevice const &                                rVDev,
                               const CanvasSharedPtr&                               rCanvas,
                               const OutDevState&                                   rState,
                               const ::basegfx::B2DHomMatrix&                       rTextTransform );
@@ -1604,7 +1604,7 @@ namespace cppcanvas
                                          const ::basegfx::B2DRectangle&                        rOutlineBounds,
                                          const uno::Reference< rendering::XPolyPolygon2D >&    rTextPoly,
                                          const uno::Sequence< double >&                        rOffsets,
                                          VirtualDevice&                                        rVDev,
                                          VirtualDevice const &                                 rVDev,
                                          const CanvasSharedPtr&                                rCanvas,
                                          const OutDevState&                                    rState  ) :
                mxTextPoly( rTextPoly ),
@@ -1645,7 +1645,7 @@ namespace cppcanvas
                                          const ::basegfx::B2DRectangle&                        rOutlineBounds,
                                          const uno::Reference< rendering::XPolyPolygon2D >&    rTextPoly,
                                          const uno::Sequence< double >&                        rOffsets,
                                          VirtualDevice&                                        rVDev,
                                          VirtualDevice const &                                 rVDev,
                                          const CanvasSharedPtr&                                rCanvas,
                                          const OutDevState&                                    rState,
                                          const ::basegfx::B2DHomMatrix&                        rTextTransform ) :
diff --git a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx
index 32b3bc7..37879cd 100644
--- a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx
@@ -398,7 +398,7 @@ namespace drawinglayer

                        public:
                            explicit Executor(
                                std::shared_ptr<comphelper::ThreadTaskTag>& rTag,
                                std::shared_ptr<comphelper::ThreadTaskTag> const & rTag,
                                processor3d::ZBufferProcessor3D* pZBufferProcessor3D,
                                const primitive3d::Primitive3DContainer& rChildren3D)
                            :   comphelper::ThreadTask(rTag),
diff --git a/extensions/source/bibliography/datman.cxx b/extensions/source/bibliography/datman.cxx
index 9890daa..9ae2804 100644
--- a/extensions/source/bibliography/datman.cxx
+++ b/extensions/source/bibliography/datman.cxx
@@ -237,8 +237,8 @@ public:
    virtual void dispose() override;
};

static sal_uInt16 lcl_FindLogicalName(BibConfig* pConfig ,
                                    const OUString& rLogicalColumnName)
static sal_uInt16 lcl_FindLogicalName(BibConfig const * pConfig ,
                                      const OUString& rLogicalColumnName)
{
    for(sal_uInt16 i = 0; i < COLUMN_COUNT; i++)
    {
diff --git a/extensions/source/bibliography/framectr.cxx b/extensions/source/bibliography/framectr.cxx
index b5cfe93..35e825f 100644
--- a/extensions/source/bibliography/framectr.cxx
+++ b/extensions/source/bibliography/framectr.cxx
@@ -366,7 +366,7 @@ bool BibFrameController_Impl::SaveModified(const Reference< form::runtime::XForm
    return bResult;
}

static vcl::Window* lcl_GetFocusChild( vcl::Window* pParent )
static vcl::Window* lcl_GetFocusChild( vcl::Window const * pParent )
{
    sal_uInt16 nChildren = pParent->GetChildCount();
    for( sal_uInt16 nChild = 0; nChild < nChildren; ++nChild)
diff --git a/extensions/source/config/ldap/ldapuserprofilebe.cxx b/extensions/source/config/ldap/ldapuserprofilebe.cxx
index 54d60e3..10f7ae0 100644
--- a/extensions/source/config/ldap/ldapuserprofilebe.cxx
+++ b/extensions/source/config/ldap/ldapuserprofilebe.cxx
@@ -157,7 +157,7 @@ bool LdapUserProfileBe::readLdapConfiguration(


bool LdapUserProfileBe::getLdapStringParam(
    uno::Reference<container::XNameAccess>& xAccess,
    uno::Reference<container::XNameAccess> const & xAccess,
    const OUString& aLdapSetting,
    OUString& aServerParameter)
{
diff --git a/extensions/source/config/ldap/ldapuserprofilebe.hxx b/extensions/source/config/ldap/ldapuserprofilebe.hxx
index 74838da..5cca247 100644
--- a/extensions/source/config/ldap/ldapuserprofilebe.hxx
+++ b/extensions/source/config/ldap/ldapuserprofilebe.hxx
@@ -116,7 +116,7 @@ class LdapUserProfileBe : private LdapProfileMutexHolder, public BackendBase
            uno::Reference<uno::XComponentContext> const & context,
            LdapDefinition * definition, OUString * loggedOnUser);

        static bool getLdapStringParam(uno::Reference<container::XNameAccess>& xAccess,
        static bool getLdapStringParam(uno::Reference<container::XNameAccess> const & xAccess,
                                const OUString& aLdapSetting,
                                OUString& aServerParameter);

diff --git a/extensions/source/update/ui/updatecheckui.cxx b/extensions/source/update/ui/updatecheckui.cxx
index 2b62b30..bf530db 100644
--- a/extensions/source/update/ui/updatecheckui.cxx
+++ b/extensions/source/update/ui/updatecheckui.cxx
@@ -77,7 +77,7 @@ static OUString getImplementationName()
namespace
{

Image GetMenuBarIcon( MenuBar* pMBar )
Image GetMenuBarIcon( MenuBar const * pMBar )
{
    OUString sResID;
    vcl::Window *pMBarWin = pMBar->GetWindow();
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index 1429951..fce3e1b 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -307,7 +307,7 @@ bool isRangeResultOpCode( OpCode eOp )
            checked, bRight==true means opcodes for right side. If bRPN==true
            it doesn't matter.
 */
bool isPotentialRangeType( FormulaToken* pToken, bool bRPN, bool bRight )
bool isPotentialRangeType( FormulaToken const * pToken, bool bRPN, bool bRight )
{
    switch (pToken->GetType())
    {
diff --git a/framework/inc/uielement/menubarmanager.hxx b/framework/inc/uielement/menubarmanager.hxx
index 77cb087..bc782db 100644
--- a/framework/inc/uielement/menubarmanager.hxx
+++ b/framework/inc/uielement/menubarmanager.hxx
@@ -153,8 +153,8 @@ class MenuBarManager:
        struct MenuItemHandler
        {
            MenuItemHandler( sal_uInt16             aItemId,
                             css::uno::Reference< css::frame::XStatusListener >& xManager,
                             css::uno::Reference< css::frame::XDispatch >& rDispatch ) :
                             css::uno::Reference< css::frame::XStatusListener > const & xManager,
                             css::uno::Reference< css::frame::XDispatch > const & rDispatch ) :
                             nItemId( aItemId ),
                             xSubMenuManager( xManager ),
                             xMenuItemDispatch( rDispatch ) {}
diff --git a/framework/inc/xml/saxnamespacefilter.hxx b/framework/inc/xml/saxnamespacefilter.hxx
index 3bea6c2..c7a5041 100644
--- a/framework/inc/xml/saxnamespacefilter.hxx
+++ b/framework/inc/xml/saxnamespacefilter.hxx
@@ -36,7 +36,7 @@ class FWE_DLLPUBLIC SaxNamespaceFilter :
                           public ::cppu::WeakImplHelper< css::xml::sax::XDocumentHandler >
{
    public:
        SaxNamespaceFilter( css::uno::Reference< css::xml::sax::XDocumentHandler >& rSax1DocumentHandler );
        SaxNamespaceFilter( css::uno::Reference< css::xml::sax::XDocumentHandler > const & rSax1DocumentHandler );
        virtual ~SaxNamespaceFilter() override;

        // XDocumentHandler
diff --git a/framework/inc/xml/toolboxdocumenthandler.hxx b/framework/inc/xml/toolboxdocumenthandler.hxx
index 36da36b..7dc7133 100644
--- a/framework/inc/xml/toolboxdocumenthandler.hxx
+++ b/framework/inc/xml/toolboxdocumenthandler.hxx
@@ -121,7 +121,7 @@ class FWE_DLLPUBLIC OWriteToolBoxDocumentHandler final
    public:
            OWriteToolBoxDocumentHandler(
                const css::uno::Reference< css::container::XIndexAccess >& rItemAccess,
                css::uno::Reference< css::xml::sax::XDocumentHandler >& rDocumentHandler );
                css::uno::Reference< css::xml::sax::XDocumentHandler > const & rDocumentHandler );
            ~OWriteToolBoxDocumentHandler();

        /// @throws css::xml::sax::SAXException
diff --git a/framework/source/fwe/xml/saxnamespacefilter.cxx b/framework/source/fwe/xml/saxnamespacefilter.cxx
index f2f8169..fc49824 100644
--- a/framework/source/fwe/xml/saxnamespacefilter.cxx
+++ b/framework/source/fwe/xml/saxnamespacefilter.cxx
@@ -35,7 +35,7 @@ using namespace ::com::sun::star::uno;

namespace framework{

SaxNamespaceFilter::SaxNamespaceFilter( Reference< XDocumentHandler >& rSax1DocumentHandler ) :
SaxNamespaceFilter::SaxNamespaceFilter( Reference< XDocumentHandler > const & rSax1DocumentHandler ) :
     m_xLocator( nullptr ),
     xDocumentHandler( rSax1DocumentHandler ),
     m_aXMLAttributeNamespace( "xmlns" ),
diff --git a/framework/source/fwe/xml/toolboxdocumenthandler.cxx b/framework/source/fwe/xml/toolboxdocumenthandler.cxx
index 633a057..50fc7df 100644
--- a/framework/source/fwe/xml/toolboxdocumenthandler.cxx
+++ b/framework/source/fwe/xml/toolboxdocumenthandler.cxx
@@ -583,7 +583,7 @@ OUString OReadToolBoxDocumentHandler::getErrorLineString()

OWriteToolBoxDocumentHandler::OWriteToolBoxDocumentHandler(
    const Reference< XIndexAccess >& rItemAccess,
    Reference< XDocumentHandler >& rWriteDocumentHandler ) :
    Reference< XDocumentHandler > const & rWriteDocumentHandler ) :
    m_xWriteDocumentHandler( rWriteDocumentHandler ),
    m_rItemAccess( rItemAccess )
{
diff --git a/idl/inc/database.hxx b/idl/inc/database.hxx
index 7994aa5..3c102ff 100644
--- a/idl/inc/database.hxx
+++ b/idl/inc/database.hxx
@@ -58,8 +58,8 @@ class SvParseException : public std::exception
{
public:
    SvIdlError aError;
    SvParseException( SvTokenStream & rInStm, const OString& rError );
    SvParseException( const OString& rError, SvToken& rTok );
    SvParseException( SvTokenStream const & rInStm, const OString& rError );
    SvParseException( const OString& rError, SvToken const & rTok );
};


diff --git a/idl/source/prj/database.cxx b/idl/source/prj/database.cxx
index 1a1057e..7fb11d9 100644
--- a/idl/source/prj/database.cxx
+++ b/idl/source/prj/database.cxx
@@ -28,14 +28,14 @@
#include <osl/file.hxx>


SvParseException::SvParseException( SvTokenStream & rInStm, const OString& rError )
SvParseException::SvParseException( SvTokenStream const & rInStm, const OString& rError )
{
    SvToken& rTok = rInStm.GetToken();
    aError = SvIdlError( rTok.GetLine(), rTok.GetColumn() );
    aError.SetText( rError );
};

SvParseException::SvParseException( const OString& rError, SvToken& rTok )
SvParseException::SvParseException( const OString& rError, SvToken const & rTok )
{
    aError = SvIdlError( rTok.GetLine(), rTok.GetColumn() );
    aError.SetText( rError );
diff --git a/include/basic/basmgr.hxx b/include/basic/basmgr.hxx
index 9cd3a50..5450228 100644
--- a/include/basic/basmgr.hxx
+++ b/include/basic/basmgr.hxx
@@ -133,8 +133,8 @@ protected:
    virtual ~BasicManager() override;

public:
                    BasicManager( SotStorage& rStorage, const OUString& rBaseURL, StarBASIC* pParentFromStdLib = nullptr, OUString* pLibPath = nullptr, bool bDocMgr = false );
                    BasicManager( StarBASIC* pStdLib, OUString* pLibPath = nullptr, bool bDocMgr = false );
                    BasicManager( SotStorage& rStorage, const OUString& rBaseURL, StarBASIC* pParentFromStdLib = nullptr, OUString const * pLibPath = nullptr, bool bDocMgr = false );
                    BasicManager( StarBASIC* pStdLib, OUString const * pLibPath = nullptr, bool bDocMgr = false );

    /** deletes the given BasicManager instance

diff --git a/include/linguistic/lngprophelp.hxx b/include/linguistic/lngprophelp.hxx
index 065a1c9..6a52633 100644
--- a/include/linguistic/lngprophelp.hxx
+++ b/include/linguistic/lngprophelp.hxx
@@ -93,7 +93,7 @@ protected:
public:
    PropertyChgHelper(
            const css::uno::Reference< css::uno::XInterface > &rxSource,
            css::uno::Reference< css::linguistic2::XLinguProperties > &rxPropSet,
            css::uno::Reference< css::linguistic2::XLinguProperties > const &rxPropSet,
            int nAllowedEvents );
    virtual ~PropertyChgHelper() override;

@@ -138,7 +138,7 @@ class PropertyHelper_Thes :
public:
    PropertyHelper_Thes(
            const css::uno::Reference< css::uno::XInterface > &rxSource,
            css::uno::Reference< css::linguistic2::XLinguProperties > &rxPropSet );
            css::uno::Reference< css::linguistic2::XLinguProperties > const &rxPropSet );
    virtual ~PropertyHelper_Thes() override;

    // XPropertyChangeListener
@@ -158,7 +158,7 @@ class LNG_DLLPUBLIC PropertyHelper_Thesaurus
public:
    PropertyHelper_Thesaurus(
            const css::uno::Reference< css::uno::XInterface > &rxSource,
            css::uno::Reference< css::linguistic2::XLinguProperties > &rxPropSet );
            css::uno::Reference< css::linguistic2::XLinguProperties > const &rxPropSet );
    ~PropertyHelper_Thesaurus();
    void    AddAsPropListener();
    void    RemoveAsPropListener();
@@ -193,7 +193,7 @@ protected:
public:
    PropertyHelper_Spell(
            const css::uno::Reference< css::uno::XInterface > &rxSource,
            css::uno::Reference< css::linguistic2::XLinguProperties > &rxPropSet );
            css::uno::Reference< css::linguistic2::XLinguProperties > const &rxPropSet );
    virtual ~PropertyHelper_Spell() override;

    virtual void    SetTmpPropVals( const css::beans::PropertyValues &rPropVals ) override;
@@ -222,7 +222,7 @@ class LNG_DLLPUBLIC PropertyHelper_Spelling
public:
    PropertyHelper_Spelling(
            const css::uno::Reference< css::uno::XInterface > &rxSource,
            css::uno::Reference< css::linguistic2::XLinguProperties > &rxPropSet );
            css::uno::Reference< css::linguistic2::XLinguProperties > const &rxPropSet );
    ~PropertyHelper_Spelling();

    void    AddAsPropListener();
@@ -266,7 +266,7 @@ protected:
public:
    PropertyHelper_Hyphen(
            const css::uno::Reference< css::uno::XInterface > &rxSource,
            css::uno::Reference< css::linguistic2::XLinguProperties > &rxPropSet);
            css::uno::Reference< css::linguistic2::XLinguProperties > const &rxPropSet);
    virtual ~PropertyHelper_Hyphen() override;

    virtual void    SetTmpPropVals( const css::beans::PropertyValues &rPropVals ) override;
@@ -292,7 +292,7 @@ class LNG_DLLPUBLIC PropertyHelper_Hyphenation
public:
    PropertyHelper_Hyphenation(
            const css::uno::Reference< css::uno::XInterface > &rxSource,
            css::uno::Reference< css::linguistic2::XLinguProperties > &rxPropSet);
            css::uno::Reference< css::linguistic2::XLinguProperties > const &rxPropSet);
    ~PropertyHelper_Hyphenation();

    void    AddAsPropListener();
diff --git a/include/registry/registry.hxx b/include/registry/registry.hxx
index e590c23..f890666 100644
--- a/include/registry/registry.hxx
+++ b/include/registry/registry.hxx
@@ -554,7 +554,7 @@ public:

        This constructor is internal only.
    */
    inline RegistryKey(Registry&    registry,
    inline RegistryKey(Registry const & registry,
                       RegKeyHandle hKey);

protected:
@@ -645,7 +645,7 @@ inline RegistryKey::RegistryKey()
    { }

/// @cond INTERNAL
inline RegistryKey::RegistryKey(Registry& registry, RegKeyHandle hKey)
inline RegistryKey::RegistryKey(Registry const & registry, RegKeyHandle hKey)
    : m_registry(registry)
    , m_hImpl(hKey)
    {
diff --git a/include/sfx2/app.hxx b/include/sfx2/app.hxx
index f0200fc..ec1747a5 100644
--- a/include/sfx2/app.hxx
+++ b/include/sfx2/app.hxx
@@ -209,7 +209,7 @@ public:
    SAL_DLLPRIVATE void         SignPDFExec_Impl(SfxRequest&);
    SAL_DLLPRIVATE void         MiscExec_Impl(SfxRequest &);
    SAL_DLLPRIVATE void         MiscState_Impl(SfxItemSet &);
    SAL_DLLPRIVATE static void  PropExec_Impl(SfxRequest &);
    SAL_DLLPRIVATE static void  PropExec_Impl(SfxRequest const &);
    SAL_DLLPRIVATE static void  PropState_Impl(SfxItemSet &);
    SAL_DLLPRIVATE void         OfaExec_Impl(SfxRequest &);
    SAL_DLLPRIVATE static void  OfaState_Impl(SfxItemSet &);
diff --git a/include/sfx2/frame.hxx b/include/sfx2/frame.hxx
index 8ac02be..94c46d6 100644
--- a/include/sfx2/frame.hxx
+++ b/include/sfx2/frame.hxx
@@ -182,7 +182,7 @@ class SFX2_DLLPUBLIC SfxFrameItem: public SfxPoolItem

public:

                            SfxFrameItem( sal_uInt16 nWhich, SfxViewFrame *p );
                            SfxFrameItem( sal_uInt16 nWhich, SfxViewFrame const *p );
                            SfxFrameItem( SfxFrame *p );
                            SfxFrameItem( sal_uInt16 nWhich, SfxFrame *p );

diff --git a/include/svl/stylepool.hxx b/include/svl/stylepool.hxx
index fc8a680..497ae84 100644
--- a/include/svl/stylepool.hxx
+++ b/include/svl/stylepool.hxx
@@ -31,7 +31,7 @@ class SVL_DLLPUBLIC StylePool final
private:
    std::unique_ptr<StylePoolImpl> pImpl;
public:
    explicit StylePool( SfxItemSet* pIgnorableItems = nullptr );
    explicit StylePool( SfxItemSet const * pIgnorableItems = nullptr );

    /** Insert a SfxItemSet into the style pool.

diff --git a/include/svl/zformat.hxx b/include/svl/zformat.hxx
index 40ae961..e2767fc 100644
--- a/include/svl/zformat.hxx
+++ b/include/svl/zformat.hxx
@@ -160,10 +160,10 @@ public:
                   LanguageType& eLan );

    // Copy ctor
    SvNumberformat( SvNumberformat& rFormat );
    SvNumberformat( SvNumberformat const & rFormat );

    // Copy ctor with exchange of format code string scanner (used in merge)
    SvNumberformat( SvNumberformat& rFormat, ImpSvNumberformatScan& rSc );
    SvNumberformat( SvNumberformat const & rFormat, ImpSvNumberformatScan& rSc );

    ~SvNumberformat();

diff --git a/include/vcl/FilterConfigItem.hxx b/include/vcl/FilterConfigItem.hxx
index 654afae..878e423c 100644
--- a/include/vcl/FilterConfigItem.hxx
+++ b/include/vcl/FilterConfigItem.hxx
@@ -57,8 +57,8 @@ class VCL_DLLPUBLIC FilterConfigItem
public:

    FilterConfigItem( const OUString& rSubTree );
    FilterConfigItem( css::uno::Sequence< css::beans::PropertyValue >* pFilterData );
    FilterConfigItem( const OUString& rSubTree, css::uno::Sequence< css::beans::PropertyValue >* pFilterData );
    FilterConfigItem( css::uno::Sequence< css::beans::PropertyValue > const * pFilterData );
    FilterConfigItem( const OUString& rSubTree, css::uno::Sequence< css::beans::PropertyValue > const * pFilterData );
    /// Writes config in destructor
    ~FilterConfigItem();
    /// Writes config and sets unmodified state again.
diff --git a/include/vcl/filter/pdfdocument.hxx b/include/vcl/filter/pdfdocument.hxx
index 6a8a859..410ce57 100644
--- a/include/vcl/filter/pdfdocument.hxx
+++ b/include/vcl/filter/pdfdocument.hxx
@@ -136,7 +136,7 @@ class VCL_DLLPUBLIC PDFReferenceElement : public PDFElement
    PDFNumberElement& m_rObject;

public:
    PDFReferenceElement(PDFDocument& rDoc, PDFNumberElement& rObject, PDFNumberElement& rGeneration);
    PDFReferenceElement(PDFDocument& rDoc, PDFNumberElement& rObject, PDFNumberElement const & rGeneration);
    bool Read(SvStream& rStream) override;
    /// Assuming the reference points to a number object, return its value.
    double LookupNumber(SvStream& rStream) const;
diff --git a/linguistic/source/convdicxml.hxx b/linguistic/source/convdicxml.hxx
index 8463d19..68824a3 100644
--- a/linguistic/source/convdicxml.hxx
+++ b/linguistic/source/convdicxml.hxx
@@ -44,7 +44,7 @@ class ConvDicXMLExport : public SvXMLExport
public:
    ConvDicXMLExport( ConvDic &rConvDic,
        const OUString &rFileName,
        css::uno::Reference< css::xml::sax::XDocumentHandler > &rHandler) :
        css::uno::Reference< css::xml::sax::XDocumentHandler > const &rHandler) :
        SvXMLExport ( comphelper::getProcessComponentContext(), "com.sun.star.lingu2.ConvDicXMLExport", rFileName,
                      css::util::MeasureUnit::CM, rHandler ),
        rDic        ( rConvDic ),
diff --git a/linguistic/source/lngprophelp.cxx b/linguistic/source/lngprophelp.cxx
index 2846569..0bf1a52 100644
--- a/linguistic/source/lngprophelp.cxx
+++ b/linguistic/source/lngprophelp.cxx
@@ -56,7 +56,7 @@ static const int nCHCount = SAL_N_ELEMENTS(aCH);

PropertyChgHelper::PropertyChgHelper(
        const Reference< XInterface > &rxSource,
        Reference< XLinguProperties > &rxPropSet,
        Reference< XLinguProperties > const &rxPropSet,
        int nAllowedEvents ) :
    PropertyChgHelperBase(),
    aPropNames          (nCHCount),
@@ -303,7 +303,7 @@ sal_Bool SAL_CALL

PropertyHelper_Thes::PropertyHelper_Thes(
        const Reference< XInterface > &rxSource,
        Reference< XLinguProperties > &rxPropSet ) :
        Reference< XLinguProperties > const &rxPropSet ) :
    PropertyChgHelper   ( rxSource, rxPropSet, 0 )
{
    SetDefaultValues();
@@ -336,7 +336,7 @@ static const char *aSP[] =

PropertyHelper_Spell::PropertyHelper_Spell(
        const Reference< XInterface > & rxSource,
        Reference< XLinguProperties > &rxPropSet ) :
        Reference< XLinguProperties > const &rxPropSet ) :
    PropertyChgHelper   ( rxSource, rxPropSet, AE_SPELLCHECKER )
{
    AddPropNames( aSP, SAL_N_ELEMENTS(aSP) );
@@ -517,7 +517,7 @@ static const char *aHP[] =

PropertyHelper_Hyphen::PropertyHelper_Hyphen(
        const Reference< XInterface > & rxSource,
        Reference< XLinguProperties > &rxPropSet ) :
        Reference< XLinguProperties > const &rxPropSet ) :
    PropertyChgHelper   ( rxSource, rxPropSet, AE_HYPHENATOR )
{
    AddPropNames( aHP, SAL_N_ELEMENTS(aHP) );
@@ -659,7 +659,7 @@ void PropertyHelper_Hyphen::SetTmpPropVals( const PropertyValues &rPropVals )

PropertyHelper_Thesaurus::PropertyHelper_Thesaurus(
            const css::uno::Reference< css::uno::XInterface > &rxSource,
            css::uno::Reference< css::linguistic2::XLinguProperties > &rxPropSet )
            css::uno::Reference< css::linguistic2::XLinguProperties > const &rxPropSet )
{
    pInst = new PropertyHelper_Thes( rxSource, rxPropSet );
    xPropHelper = pInst;
@@ -686,7 +686,7 @@ void PropertyHelper_Thesaurus::SetTmpPropVals( const css::beans::PropertyValues 

PropertyHelper_Hyphenation::PropertyHelper_Hyphenation(
            const css::uno::Reference< css::uno::XInterface > &rxSource,
            css::uno::Reference< css::linguistic2::XLinguProperties > &rxPropSet)
            css::uno::Reference< css::linguistic2::XLinguProperties > const &rxPropSet)
{
    pInst = new PropertyHelper_Hyphen( rxSource, rxPropSet );
    xPropHelper = pInst;
@@ -740,7 +740,7 @@ bool PropertyHelper_Hyphenation::removeLinguServiceEventListener(

PropertyHelper_Spelling::PropertyHelper_Spelling(
            const css::uno::Reference< css::uno::XInterface > &rxSource,
            css::uno::Reference< css::linguistic2::XLinguProperties > &rxPropSet )
            css::uno::Reference< css::linguistic2::XLinguProperties > const &rxPropSet )
{
    pInst = new PropertyHelper_Spell( rxSource, rxPropSet );
    xPropHelper = pInst;
diff --git a/sfx2/source/appl/appbas.cxx b/sfx2/source/appl/appbas.cxx
index c9184bb..99d9573 100644
--- a/sfx2/source/appl/appbas.cxx
+++ b/sfx2/source/appl/appbas.cxx
@@ -140,7 +140,7 @@ StarBASIC* SfxApplication::GetBasic()
#endif
}

void SfxApplication::PropExec_Impl( SfxRequest &rReq )
void SfxApplication::PropExec_Impl( SfxRequest const &rReq )
{
    sal_uInt16 nSID = rReq.GetSlot();
    switch ( nSID )
diff --git a/sfx2/source/appl/helpinterceptor.cxx b/sfx2/source/appl/helpinterceptor.cxx
index 4e3db51..03f81a2 100644
--- a/sfx2/source/appl/helpinterceptor.cxx
+++ b/sfx2/source/appl/helpinterceptor.cxx
@@ -278,7 +278,7 @@ void SAL_CALL HelpListener_Impl::disposing( const css::lang::EventObject& )
}

HelpStatusListener_Impl::HelpStatusListener_Impl(
        Reference < XDispatch > const & aDispatch, URL& rURL)
        Reference < XDispatch > const & aDispatch, URL const & rURL)
{
    aDispatch->addStatusListener(this, rURL);
}
diff --git a/sfx2/source/appl/helpinterceptor.hxx b/sfx2/source/appl/helpinterceptor.hxx
index f557d35..6f3f4be 100644
--- a/sfx2/source/appl/helpinterceptor.hxx
+++ b/sfx2/source/appl/helpinterceptor.hxx
@@ -140,7 +140,7 @@ private:
public:
    HelpStatusListener_Impl(
        css::uno::Reference < css::frame::XDispatch > const & xDispatch,
        css::util::URL& rURL);
        css::util::URL const & rURL);
    virtual ~HelpStatusListener_Impl() override;

    virtual void SAL_CALL   statusChanged( const css::frame::FeatureStateEvent& Event ) override;
diff --git a/sfx2/source/appl/impldde.cxx b/sfx2/source/appl/impldde.cxx
index d0d3694..ff7898e 100644
--- a/sfx2/source/appl/impldde.cxx
+++ b/sfx2/source/appl/impldde.cxx
@@ -61,13 +61,13 @@ class SvDDELinkEditDialog : public ModalDialog

    DECL_LINK( EditHdl_Impl, Edit&, void );
public:
    SvDDELinkEditDialog( vcl::Window* pParent, SvBaseLink* );
    SvDDELinkEditDialog( vcl::Window* pParent, SvBaseLink const * );
    virtual ~SvDDELinkEditDialog() override;
    virtual void dispose() override;
    OUString GetCmd() const;
};

SvDDELinkEditDialog::SvDDELinkEditDialog( vcl::Window* pParent, SvBaseLink* pLink )
SvDDELinkEditDialog::SvDDELinkEditDialog( vcl::Window* pParent, SvBaseLink const * pLink )
    : ModalDialog( pParent, "LinkEditDialog", "sfx/ui/linkeditdialog.ui" )
{
    get(m_pOKButton, "ok");
diff --git a/sfx2/source/dialog/recfloat.cxx b/sfx2/source/dialog/recfloat.cxx
index f73a194..ed05e03 100644
--- a/sfx2/source/dialog/recfloat.cxx
+++ b/sfx2/source/dialog/recfloat.cxx
@@ -34,7 +34,7 @@ SFX_IMPL_FLOATINGWINDOW( SfxRecordingFloatWrapper_Impl, SID_RECORDING_FLOATWINDO
SfxRecordingFloatWrapper_Impl::SfxRecordingFloatWrapper_Impl( vcl::Window* pParentWnd ,
                                                sal_uInt16 nId ,
                                                SfxBindings* pBind ,
                                                SfxChildWinInfo* pInfo )
                                                SfxChildWinInfo const * pInfo )
                    : SfxChildWindow( pParentWnd, nId )
                    , pBindings( pBind )
{
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index 51b3cfb..19bccfb 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -339,11 +339,11 @@ class SfxOwnFramesLocker

    static vcl::Window* GetVCLWindow( const Reference< frame::XFrame >& xFrame );
public:
    explicit SfxOwnFramesLocker( SfxObjectShell* ObjechShell );
    explicit SfxOwnFramesLocker( SfxObjectShell const * ObjechShell );
    ~SfxOwnFramesLocker();
};

SfxOwnFramesLocker::SfxOwnFramesLocker( SfxObjectShell* pObjectShell )
SfxOwnFramesLocker::SfxOwnFramesLocker( SfxObjectShell const * pObjectShell )
{
    if ( !pObjectShell )
        return;
diff --git a/sfx2/source/inc/docundomanager.hxx b/sfx2/source/inc/docundomanager.hxx
index 22b21b8..108de6f 100644
--- a/sfx2/source/inc/docundomanager.hxx
+++ b/sfx2/source/inc/docundomanager.hxx
@@ -72,7 +72,7 @@ public:
        E_FULLY_ALIVE
    };

    SfxModelGuard( SfxBaseModel& i_rModel, const AllowedModelState i_eState = E_FULLY_ALIVE )
    SfxModelGuard( SfxBaseModel const & i_rModel, const AllowedModelState i_eState = E_FULLY_ALIVE )
        : m_aGuard()
    {
        i_rModel.MethodEntryCheck( i_eState != E_INITIALIZING );
diff --git a/sfx2/source/inc/recfloat.hxx b/sfx2/source/inc/recfloat.hxx
index d3bfd42..9862927 100644
--- a/sfx2/source/inc/recfloat.hxx
+++ b/sfx2/source/inc/recfloat.hxx
@@ -30,7 +30,7 @@ public:
                        SfxRecordingFloatWrapper_Impl( vcl::Window* pParent ,
                                                sal_uInt16 nId ,
                                                SfxBindings* pBindings ,
                                                SfxChildWinInfo* pInfo );
                                                SfxChildWinInfo const * pInfo );
                        virtual ~SfxRecordingFloatWrapper_Impl() override;

                        SFX_DECL_CHILDWINDOW(SfxRecordingFloatWrapper_Impl);
diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx
index 73d7f56..a092eef 100644
--- a/sfx2/source/view/frame.cxx
+++ b/sfx2/source/view/frame.cxx
@@ -395,7 +395,7 @@ void SfxFrame::RemoveTopFrame_Impl( SfxFrame* pFrame )
        rArr.erase( it );
}

SfxFrameItem::SfxFrameItem( sal_uInt16 nWhichId, SfxViewFrame *p )
SfxFrameItem::SfxFrameItem( sal_uInt16 nWhichId, SfxViewFrame const *p )
    : SfxPoolItem( nWhichId ), pFrame( p ? &p->GetFrame() : nullptr )
{
    wFrame = pFrame;
diff --git a/smoketest/libtest.cxx b/smoketest/libtest.cxx
index 5699683..c7e8970 100644
--- a/smoketest/libtest.cxx
+++ b/smoketest/libtest.cxx
@@ -45,7 +45,7 @@
        return t.tv_sec*1000 + t.tv_usec/1000;
    }

    bool IsAbsolutePath(char *pPath)
    bool IsAbsolutePath(char const *pPath)
    {
        if (pPath[0] != '/')
        {
diff --git a/solenv/CompilerTest_compilerplugins_clang.mk b/solenv/CompilerTest_compilerplugins_clang.mk
index a7429c2..22bbb1f 100644
--- a/solenv/CompilerTest_compilerplugins_clang.mk
+++ b/solenv/CompilerTest_compilerplugins_clang.mk
@@ -11,6 +11,7 @@ $(eval $(call gb_CompilerTest_CompilerTest,compilerplugins_clang))

$(eval $(call gb_CompilerTest_add_exception_objects,compilerplugins_clang, \
    compilerplugins/clang/test/casttovoid \
    compilerplugins/clang/test/constparams \
    compilerplugins/clang/test/cppunitassertequals \
    compilerplugins/clang/test/datamembershadow \
    compilerplugins/clang/test/externvar \
diff --git a/store/source/lockbyte.cxx b/store/source/lockbyte.cxx
index 581a515..e4fc180 100644
--- a/store/source/lockbyte.cxx
+++ b/store/source/lockbyte.cxx
@@ -306,7 +306,7 @@ class FileLockBytes :
public:
    /** Construction.
     */
    explicit FileLockBytes (FileHandle & rFile);
    explicit FileLockBytes (FileHandle const & rFile);

    FileLockBytes(const FileLockBytes&) = delete;
    FileLockBytes& operator=(const FileLockBytes&) = delete;
@@ -319,7 +319,7 @@ protected:

} // namespace store

FileLockBytes::FileLockBytes (FileHandle & rFile)
FileLockBytes::FileLockBytes (FileHandle const & rFile)
    : m_hFile (rFile.m_handle), m_nSize (SAL_MAX_UINT32), m_xAllocator()
{
}
@@ -534,7 +534,7 @@ class MappedLockBytes :
public:
    /** Construction.
     */
    explicit MappedLockBytes (FileMapping & rMapping);
    explicit MappedLockBytes (FileMapping const & rMapping);

    MappedLockBytes(const MappedLockBytes&) = delete;
    MappedLockBytes& operator=(const MappedLockBytes&) = delete;
@@ -547,7 +547,7 @@ protected:

} // namespace store

MappedLockBytes::MappedLockBytes (FileMapping & rMapping)
MappedLockBytes::MappedLockBytes (FileMapping const & rMapping)
    : m_pData (rMapping.m_pAddr), m_nSize (rMapping.m_nSize), m_nPageSize(0), m_hFile (rMapping.m_hFile)
{
}
diff --git a/svl/source/items/stylepool.cxx b/svl/source/items/stylepool.cxx
index cfc61ab..15be4eb 100644
--- a/svl/source/items/stylepool.cxx
+++ b/svl/source/items/stylepool.cxx
@@ -350,7 +350,7 @@ private:
    std::unique_ptr<SfxItemSet> mpIgnorableItems;
public:
    // #i86923#
    explicit StylePoolImpl( SfxItemSet* pIgnorableItems )
    explicit StylePoolImpl( SfxItemSet const * pIgnorableItems )
        : maRoot(),
          mpIgnorableItems( pIgnorableItems != nullptr
                            ? pIgnorableItems->Clone( false )
@@ -444,7 +444,7 @@ IStylePoolIteratorAccess* StylePoolImpl::createIterator( bool bSkipUnusedItemSet
// Ctor, Dtor and redirected methods of class StylePool, nearly inline ;-)

// #i86923#
StylePool::StylePool( SfxItemSet* pIgnorableItems )
StylePool::StylePool( SfxItemSet const * pIgnorableItems )
    : pImpl( new StylePoolImpl( pIgnorableItems ) )
{}

diff --git a/svl/source/numbers/numfmuno.cxx b/svl/source/numbers/numfmuno.cxx
index 9c014f0..0ed49e8 100644
--- a/svl/source/numbers/numfmuno.cxx
+++ b/svl/source/numbers/numfmuno.cxx
@@ -368,7 +368,7 @@ uno::Sequence<OUString> SAL_CALL SvNumberFormatterServiceObj::getSupportedServic
    return { "com.sun.star.util.NumberFormatter" };
}

SvNumberFormatsObj::SvNumberFormatsObj( SvNumberFormatsSupplierObj& _rParent, ::comphelper::SharedMutex& _rMutex )
SvNumberFormatsObj::SvNumberFormatsObj( SvNumberFormatsSupplierObj& _rParent, ::comphelper::SharedMutex const & _rMutex )
    :rSupplier( _rParent )
    ,m_aMutex( _rMutex )
{
diff --git a/svl/source/numbers/numfmuno.hxx b/svl/source/numbers/numfmuno.hxx
index 01c5825..3885e2d 100644
--- a/svl/source/numbers/numfmuno.hxx
+++ b/svl/source/numbers/numfmuno.hxx
@@ -91,7 +91,7 @@ private:
    mutable ::comphelper::SharedMutex   m_aMutex;

public:
                    SvNumberFormatsObj(SvNumberFormatsSupplierObj& pParent, ::comphelper::SharedMutex& _rMutex);
                    SvNumberFormatsObj(SvNumberFormatsSupplierObj& pParent, ::comphelper::SharedMutex const & _rMutex);
    virtual         ~SvNumberFormatsObj() override;


diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index 2241905..d12c362 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -407,13 +407,13 @@ void SvNumberformat::ImpCopyNumberformat( const SvNumberformat& rFormat )
    }
}

SvNumberformat::SvNumberformat( SvNumberformat& rFormat )
SvNumberformat::SvNumberformat( SvNumberformat const & rFormat )
    : rScan(rFormat.rScan), bStarFlag( rFormat.bStarFlag )
{
    ImpCopyNumberformat( rFormat );
}

SvNumberformat::SvNumberformat( SvNumberformat& rFormat, ImpSvNumberformatScan& rSc )
SvNumberformat::SvNumberformat( SvNumberformat const & rFormat, ImpSvNumberformatScan& rSc )
    : rScan(rSc)
    , bStarFlag( rFormat.bStarFlag )
{
diff --git a/svtools/source/graphic/grfcache.cxx b/svtools/source/graphic/grfcache.cxx
index 7684a08..8c31a48 100644
--- a/svtools/source/graphic/grfcache.cxx
+++ b/svtools/source/graphic/grfcache.cxx
@@ -421,7 +421,7 @@ public:
public:

                                GraphicDisplayCacheEntry( const GraphicCacheEntry* pRefCacheEntry,
                                                          OutputDevice* pOut, const Point& rPt, const Size& rSz,
                                                          OutputDevice const * pOut, const Point& rPt, const Size& rSz,
                                                          const GraphicObject& rObj, const GraphicAttr& rAttr,
                                                          const BitmapEx& rBmpEx ) :
                                    mpRefCacheEntry( pRefCacheEntry ),
@@ -434,7 +434,7 @@ public:
                                    }

                                GraphicDisplayCacheEntry( const GraphicCacheEntry* pRefCacheEntry,
                                                          OutputDevice* pOut, const Point& rPt, const Size& rSz,
                                                          OutputDevice const * pOut, const Point& rPt, const Size& rSz,
                                                          const GraphicObject& rObj, const GraphicAttr& rAttr,
                                                          const GDIMetaFile& rMtf ) :
                                    mpRefCacheEntry( pRefCacheEntry ),
@@ -1108,7 +1108,7 @@ OString GraphicCache::GetUniqueID( const GraphicObject& rObj ) const
    return aRet;
}

bool GraphicCache::CreateDisplayCacheObj( OutputDevice* pOut, const Point& rPt, const Size& rSz,
bool GraphicCache::CreateDisplayCacheObj( OutputDevice const * pOut, const Point& rPt, const Size& rSz,
                                          const GraphicObject& rObj, const GraphicAttr& rAttr,
                                          const BitmapEx& rBmpEx )
{
@@ -1140,7 +1140,7 @@ bool GraphicCache::CreateDisplayCacheObj( OutputDevice* pOut, const Point& rPt, 
    return bRet;
}

bool GraphicCache::CreateDisplayCacheObj( OutputDevice* pOut, const Point& rPt, const Size& rSz,
bool GraphicCache::CreateDisplayCacheObj( OutputDevice const * pOut, const Point& rPt, const Size& rSz,
                                          const GraphicObject& rObj, const GraphicAttr& rAttr,
                                          const GDIMetaFile& rMtf )
{
diff --git a/svtools/source/graphic/grfcache.hxx b/svtools/source/graphic/grfcache.hxx
index 4402573..ac6c1a8 100644
--- a/svtools/source/graphic/grfcache.hxx
+++ b/svtools/source/graphic/grfcache.hxx
@@ -107,7 +107,7 @@ public:
                            ) const;

    bool                CreateDisplayCacheObj(
                                OutputDevice* pOut,
                                OutputDevice const * pOut,
                                const Point& rPt,
                                const Size& rSz,
                                const GraphicObject& rObj,
@@ -116,7 +116,7 @@ public:
                            );

    bool                CreateDisplayCacheObj(
                                OutputDevice* pOut,
                                OutputDevice const * pOut,
                                const Point& rPt,
                                const Size& rSz,
                                const GraphicObject& rObj,
diff --git a/svtools/source/uno/treecontrolpeer.cxx b/svtools/source/uno/treecontrolpeer.cxx
index 54e7d09..b4ebeb6 100644
--- a/svtools/source/uno/treecontrolpeer.cxx
+++ b/svtools/source/uno/treecontrolpeer.cxx
@@ -73,7 +73,7 @@ public:
class ImplContextGraphicItem : public SvLBoxContextBmp
{
public:
    ImplContextGraphicItem( Image& rI1,Image& rI2, bool bExpanded)
    ImplContextGraphicItem( Image const & rI1, Image const & rI2, bool bExpanded)
        : SvLBoxContextBmp(rI1, rI2, bExpanded) {}

    OUString msExpandedGraphicURL;
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index 0cb452f..0a340b1 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -414,8 +414,7 @@ OUString GetWordDefaultDateStringAsUS(SvNumberFormatter* pFormatter, LanguageTyp
    //convert back to the correct language layout.
    const sal_uInt32 nIndex = pFormatter->GetFormatIndex(NF_DATE_SYSTEM_SHORT, nLang);

    SvNumberformat aFormat = const_cast<SvNumberformat &>
        (*(pFormatter->GetEntry(nIndex)));
    SvNumberformat aFormat = *(pFormatter->GetEntry(nIndex));
    aFormat.ConvertLanguage(*pFormatter, nLang, LANGUAGE_ENGLISH_US);

    OUString sParams(aFormat.GetFormatstring());
diff --git a/toolkit/source/awt/stylesettings.cxx b/toolkit/source/awt/stylesettings.cxx
index f0e7375..419216e 100644
--- a/toolkit/source/awt/stylesettings.cxx
+++ b/toolkit/source/awt/stylesettings.cxx
@@ -80,7 +80,7 @@ namespace toolkit
    class StyleMethodGuard
    {
    public:
        explicit StyleMethodGuard( WindowStyleSettings_Data& i_rData )
        explicit StyleMethodGuard( WindowStyleSettings_Data const & i_rData )
        {
            if ( i_rData.pOwningWindow == nullptr )
                throw DisposedException();
diff --git a/toolkit/source/controls/grid/sortablegriddatamodel.cxx b/toolkit/source/controls/grid/sortablegriddatamodel.cxx
index 90e50d9..af96671 100644
--- a/toolkit/source/controls/grid/sortablegriddatamodel.cxx
+++ b/toolkit/source/controls/grid/sortablegriddatamodel.cxx
@@ -514,7 +514,7 @@ public:
        public:
            CellDataLessComparison(
                ::std::vector< Any > const & i_data,
                ::comphelper::IKeyPredicateLess& i_predicate,
                ::comphelper::IKeyPredicateLess const & i_predicate,
                bool const i_sortAscending
            )
                :m_data( i_data )
diff --git a/vcl/inc/unx/glyphcache.hxx b/vcl/inc/unx/glyphcache.hxx
index 6c78ca5..32c67d1 100644
--- a/vcl/inc/unx/glyphcache.hxx
+++ b/vcl/inc/unx/glyphcache.hxx
@@ -198,7 +198,7 @@ private:
class VCL_DLLPUBLIC FreetypeFontInstance : public LogicalFontInstance
{
public:
                            FreetypeFontInstance( FontSelectPattern& );
                            FreetypeFontInstance( FontSelectPattern const & );
    virtual                 ~FreetypeFontInstance() override;

    void                    SetFreetypeFont(FreetypeFont* p);
diff --git a/vcl/opengl/PackedTextureAtlas.cxx b/vcl/opengl/PackedTextureAtlas.cxx
index bd1b829..ee1ca82 100644
--- a/vcl/opengl/PackedTextureAtlas.cxx
+++ b/vcl/opengl/PackedTextureAtlas.cxx
@@ -26,7 +26,7 @@ struct Node
    bool mOccupied;

    explicit Node(int nWidth, int nHeight);
    explicit Node(tools::Rectangle& aRectangle);
    explicit Node(tools::Rectangle const & aRectangle);

    bool isLeaf();
    Node* insert(int nWidth, int nHeight, int nPadding);
@@ -39,7 +39,7 @@ Node::Node(int nWidth, int nHeight)
    , mOccupied(false)
{}

Node::Node(tools::Rectangle& aRectangle)
Node::Node(tools::Rectangle const & aRectangle)
    : mRectangle(aRectangle)
    , mLeftNode()
    , mRightNode()
diff --git a/vcl/source/filter/FilterConfigItem.cxx b/vcl/source/filter/FilterConfigItem.cxx
index 2047ff8..b0458df 100644
--- a/vcl/source/filter/FilterConfigItem.cxx
+++ b/vcl/source/filter/FilterConfigItem.cxx
@@ -144,7 +144,7 @@ FilterConfigItem::FilterConfigItem( const OUString& rSubTree )
    ImpInitTree( rSubTree );
}

FilterConfigItem::FilterConfigItem( css::uno::Sequence< css::beans::PropertyValue >* pFilterData )
FilterConfigItem::FilterConfigItem( css::uno::Sequence< css::beans::PropertyValue > const * pFilterData )
    : bModified(false)
{
    if ( pFilterData )
@@ -152,7 +152,7 @@ FilterConfigItem::FilterConfigItem( css::uno::Sequence< css::beans::PropertyValu
}

FilterConfigItem::FilterConfigItem( const OUString& rSubTree,
    css::uno::Sequence< css::beans::PropertyValue >* pFilterData )
    css::uno::Sequence< css::beans::PropertyValue > const * pFilterData )
{
    ImpInitTree( rSubTree );

diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index b99d5e0..23070eb1 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -2030,7 +2030,7 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString& r
    if( nFormat >= nFormatCount )
        return ImplSetError( ERRCODE_GRFILTER_FORMATERROR );

    FilterConfigItem aConfigItem( const_cast<css::uno::Sequence< css::beans::PropertyValue >*>(pFilterData) );
    FilterConfigItem aConfigItem( pFilterData );
    OUString aFilterName( pConfig->GetExportFilterName( nFormat ) );
#ifndef DISABLE_DYNLOADING
    OUString aExternalFilterName(pConfig->GetExternalFilterName(nFormat, true));
diff --git a/vcl/source/filter/ipdf/pdfdocument.cxx b/vcl/source/filter/ipdf/pdfdocument.cxx
index f6a8de0..a7ad2c7 100644
--- a/vcl/source/filter/ipdf/pdfdocument.cxx
+++ b/vcl/source/filter/ipdf/pdfdocument.cxx
@@ -2727,7 +2727,7 @@ PDFDocument& PDFObjectElement::GetDocument()
    return m_rDoc;
}

PDFReferenceElement::PDFReferenceElement(PDFDocument& rDoc, PDFNumberElement& rObject, PDFNumberElement& rGeneration)
PDFReferenceElement::PDFReferenceElement(PDFDocument& rDoc, PDFNumberElement& rObject, PDFNumberElement const & rGeneration)
    : m_rDoc(rDoc),
      m_fObjectValue(rObject.GetValue()),
      m_fGenerationValue(rGeneration.GetValue()),
diff --git a/vcl/source/filter/jpeg/JpegWriter.cxx b/vcl/source/filter/jpeg/JpegWriter.cxx
index eff1bac..1cf3023 100644
--- a/vcl/source/filter/jpeg/JpegWriter.cxx
+++ b/vcl/source/filter/jpeg/JpegWriter.cxx
@@ -109,7 +109,7 @@ JPEGWriter::JPEGWriter( SvStream& rStream, const css::uno::Sequence< css::beans:
    mbNative     ( false ),
    mpExpWasGrey ( pExportWasGrey )
{
    FilterConfigItem aConfigItem( const_cast<css::uno::Sequence< css::beans::PropertyValue >*>(pFilterData) );
    FilterConfigItem aConfigItem( pFilterData );
    mbGreys = aConfigItem.ReadInt32( "ColorMode", 0 ) != 0;
    mnQuality = aConfigItem.ReadInt32( "Quality", 75 );
    maChromaSubsampling = aConfigItem.ReadInt32( "ChromaSubsamplingMode", 0 );
diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index 0714355..40ad7f2 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -718,7 +718,7 @@ struct LinearScaleContext
    std::unique_ptr<long[]> mpMapXOffset;
    std::unique_ptr<long[]> mpMapYOffset;

    LinearScaleContext(tools::Rectangle& aDstRect, tools::Rectangle& aBitmapRect,
    LinearScaleContext(tools::Rectangle const & aDstRect, tools::Rectangle& aBitmapRect,
                 Size& aOutSize, long nOffX, long nOffY)

        : mpMapX(new long[aDstRect.GetWidth()])
@@ -882,7 +882,7 @@ struct TradScaleContext
    std::unique_ptr<long[]> mpMapX;
    std::unique_ptr<long[]> mpMapY;

    TradScaleContext(tools::Rectangle& aDstRect, tools::Rectangle& aBitmapRect,
    TradScaleContext(tools::Rectangle const & aDstRect, tools::Rectangle& aBitmapRect,
                 Size& aOutSize, long nOffX, long nOffY)

        : mpMapX(new long[aDstRect.GetWidth()])
diff --git a/vcl/unx/generic/glyphs/glyphcache.cxx b/vcl/unx/generic/glyphs/glyphcache.cxx
index 5ca4abe..c4c54ad 100644
--- a/vcl/unx/generic/glyphs/glyphcache.cxx
+++ b/vcl/unx/generic/glyphs/glyphcache.cxx
@@ -349,7 +349,7 @@ void FreetypeFont::GarbageCollect( long nMinLruIndex )
    }
}

FreetypeFontInstance::FreetypeFontInstance( FontSelectPattern& rFSD )
FreetypeFontInstance::FreetypeFontInstance( FontSelectPattern const & rFSD )
:   LogicalFontInstance( rFSD )
,   mpFreetypeFont( nullptr )
{}
diff --git a/vcl/unx/generic/print/genprnpsp.cxx b/vcl/unx/generic/print/genprnpsp.cxx
index d400e1d..df5ea05 100644
--- a/vcl/unx/generic/print/genprnpsp.cxx
+++ b/vcl/unx/generic/print/genprnpsp.cxx
@@ -99,7 +99,7 @@ namespace

    public:
        // parent window, Query text, initial value
        QueryString(vcl::Window*, OUString &, OUString &);
        QueryString(vcl::Window*, OUString const &, OUString &);
        virtual ~QueryString() override { disposeOnce(); }
        virtual void dispose() override
        {
@@ -113,7 +113,7 @@ namespace
    /*
     *  QueryString
     */
    QueryString::QueryString(vcl::Window* pParent, OUString& rQuery, OUString& rRet)
    QueryString::QueryString(vcl::Window* pParent, OUString const & rQuery, OUString& rRet)
        : ModalDialog(pParent, "QueryDialog",
            "vcl/ui/querydialog.ui" )
        , m_rReturnValue( rRet )
diff --git a/xmlscript/source/xmldlg_imexp/imp_share.hxx b/xmlscript/source/xmldlg_imexp/imp_share.hxx
index e3384ab..e0da693 100644
--- a/xmlscript/source/xmldlg_imexp/imp_share.hxx
+++ b/xmlscript/source/xmldlg_imexp/imp_share.hxx
@@ -152,8 +152,8 @@ public:
        css::uno::Reference<css::uno::XComponentContext> const & xContext,
        css::uno::Reference<css::container::XNameContainer>
        const & xDialogModel,
        std::shared_ptr< std::vector< OUString > >& pStyleNames,
        std::shared_ptr< std::vector< css::uno::Reference< css::xml::input::XElement > > >& pStyles,
        std::shared_ptr< std::vector< OUString > > const & pStyleNames,
        std::shared_ptr< std::vector< css::uno::Reference< css::xml::input::XElement > > > const & pStyles,
        css::uno::Reference<css::frame::XModel> const & xDoc )
        : _xContext( xContext )
        , _pStyleNames( pStyleNames )