Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 2cf94b0b authored by Kevin Funk's avatar Kevin Funk

clang-tidy: performance-unnecessary-value-param

(Without the transformations to std::move(...))

(cherry picked from commit f5b25083)
parent a399ed82
......@@ -8,7 +8,7 @@ set(KDEVELOP_VERSION_PATCH 40)
set( KDEVELOP_VERSION "${KDEVELOP_VERSION_MAJOR}.${KDEVELOP_VERSION_MINOR}.${KDEVELOP_VERSION_PATCH}" )
# plugin versions listed in the .desktop files
set(KDEV_PLUGIN_VERSION 29)
set(KDEV_PLUGIN_VERSION 30)
# we need some parts of the ECM CMake helpers
find_package (ECM 5.14.0 REQUIRED NO_MODULE)
......
......@@ -105,7 +105,7 @@ QModelIndex FrameStackModelPrivate::indexForThreadNumber(int threadNumber)
return QModelIndex();
}
void FrameStackModel::setFrames(int threadNumber, QList<FrameItem> frames)
void FrameStackModel::setFrames(int threadNumber, const QList<FrameItem>& frames)
{
QModelIndex threadIndex = d->indexForThreadNumber(threadNumber);
Q_ASSERT(threadIndex.isValid());
......
......@@ -59,7 +59,7 @@ public:
* @note The currentFrame property will be set to the first frame
* containing debug information
*/
void setFrames(int threadNumber, QList<FrameItem> frames);
void setFrames(int threadNumber, const QList<FrameItem>& frames);
void insertFrames(int threadNumber, const QList<FrameItem> &frames);
void setHasMoreFrames(int threadNumber, bool hasMoreFrames);
FrameItem frame(const QModelIndex &index) override;
......
......@@ -247,7 +247,7 @@ void PathMappingsWidget::loadFromConfiguration(const KConfigGroup& cfg)
static_cast<PathMappingModel*>(m_pathMappingTable->model())->loadFromConfiguration(cfg);
}
void PathMappingsWidget::saveToConfiguration(KConfigGroup cfg) const
void PathMappingsWidget::saveToConfiguration(const KConfigGroup& cfg) const
{
static_cast<PathMappingModel*>(m_pathMappingTable->model())->saveToConfiguration(cfg);
}
......
......@@ -52,7 +52,7 @@ public:
explicit PathMappingsWidget(QWidget* parent = nullptr);
void loadFromConfiguration(const KConfigGroup& cfg);
void saveToConfiguration(KConfigGroup cfg) const;
void saveToConfiguration(const KConfigGroup& cfg) const;
Q_SIGNALS:
void changed();
......
......@@ -75,7 +75,7 @@ StaticAssistantsManager::~StaticAssistantsManager()
{
}
void StaticAssistantsManager::registerAssistant(const StaticAssistant::Ptr assistant)
void StaticAssistantsManager::registerAssistant(const StaticAssistant::Ptr& assistant)
{
if (d->m_registeredAssistants.contains(assistant))
return;
......@@ -83,7 +83,7 @@ void StaticAssistantsManager::registerAssistant(const StaticAssistant::Ptr assis
d->m_registeredAssistants << assistant;
}
void StaticAssistantsManager::unregisterAssistant(const StaticAssistant::Ptr assistant)
void StaticAssistantsManager::unregisterAssistant(const StaticAssistant::Ptr& assistant)
{
d->m_registeredAssistants.removeOne(assistant);
}
......
......@@ -57,8 +57,8 @@ public:
explicit StaticAssistantsManager(QObject* parent = nullptr);
~StaticAssistantsManager() override;
void registerAssistant(const StaticAssistant::Ptr assistant);
void unregisterAssistant(const StaticAssistant::Ptr assistant);
void registerAssistant(const StaticAssistant::Ptr& assistant);
void unregisterAssistant(const StaticAssistant::Ptr& assistant);
QVector<StaticAssistant::Ptr> registeredAssistants() const;
void notifyAssistants(const IndexedString& url, const KDevelop::ReferencedTopDUContext& context);
......
......@@ -72,7 +72,7 @@ ClassModel::~ClassModel()
delete m_topNode;
}
void ClassModel::updateFilterString(QString a_newFilterString)
void ClassModel::updateFilterString(const QString& a_newFilterString)
{
m_allClassesNode->updateFilterString(a_newFilterString);
foreach ( ClassModelNodes::FilteredProjectFolder* folder, m_projectNodes ) {
......
......@@ -102,7 +102,7 @@ public:
public Q_SLOTS:
/// Call this to update the filter string for the search results folder.
void updateFilterString(QString a_newFilterString);
void updateFilterString(const QString& a_newFilterString);
/// removes the project-specific node
void removeProjectNode(KDevelop::IProject* project);
......
......@@ -38,7 +38,7 @@ QString CodeCompletionContext::extractLastLine(const QString& str) {
int completionRecursionDepth = 0;
CodeCompletionContext::CodeCompletionContext(DUContextPointer context, const QString& text, const KDevelop::CursorInRevision& position, int depth)
CodeCompletionContext::CodeCompletionContext(const DUContextPointer& context, const QString& text, const KDevelop::CursorInRevision& position, int depth)
: m_text(text), m_depth(depth), m_valid(true), m_position(position), m_duContext(context), m_parentContext(nullptr)
{
IntPusher( completionRecursionDepth, completionRecursionDepth+1 );
......
......@@ -50,7 +50,7 @@ namespace KDevelop {
*
* @warning The du-chain must be unlocked when this is called
* */
CodeCompletionContext(KDevelop::DUContextPointer context, const QString& text, const KDevelop::CursorInRevision& position, int depth = 0);
CodeCompletionContext(const KDevelop::DUContextPointer& context, const QString& text, const KDevelop::CursorInRevision& position, int depth = 0);
virtual ~CodeCompletionContext();
/**
......
......@@ -28,7 +28,7 @@
namespace KDevelop {
void insertFunctionParenText(KTextEditor::View* view, const KTextEditor::Cursor& pos, DeclarationPointer declaration, bool jumpForbidden)
void insertFunctionParenText(KTextEditor::View* view, const KTextEditor::Cursor& pos, const DeclarationPointer& declaration, bool jumpForbidden)
{
bool spaceBeforeParen = false; ///@todo Take this from some astyle config or something
bool spaceBetweenParens = false;
......
......@@ -30,7 +30,7 @@ namespace KTextEditor {
namespace KDevelop {
class Declaration;
void KDEVPLATFORMLANGUAGE_EXPORT insertFunctionParenText(KTextEditor::View* view, const KTextEditor::Cursor& pos, KDevelop::DeclarationPointer declaration, bool jumpForbidden = false);
void KDEVPLATFORMLANGUAGE_EXPORT insertFunctionParenText(KTextEditor::View* view, const KTextEditor::Cursor& pos, const KDevelop::DeclarationPointer& declaration, bool jumpForbidden = false);
}
#endif
......@@ -151,7 +151,7 @@ QList<IndexedType> CompletionTreeItem::typeForArgumentMatching() const {
return QList<IndexedType>();
}
CompletionCustomGroupNode::CompletionCustomGroupNode(QString groupName, int _inheritanceDepth) {
CompletionCustomGroupNode::CompletionCustomGroupNode(const QString& groupName, int _inheritanceDepth) {
role = (KTextEditor::CodeCompletionModel::ExtraItemDataRoles)Qt::DisplayRole;
roleValue = groupName;
inheritanceDepth = _inheritanceDepth;
......
......@@ -136,7 +136,7 @@ public:
/// The items in the group will be shown in the completion-list with a group-header that contains the given name
struct KDEVPLATFORMLANGUAGE_EXPORT CompletionCustomGroupNode : public CompletionTreeNode {
/// @param inheritanceDepth See KTextEditor::CodeCompletionModel::GroupRole
explicit CompletionCustomGroupNode(QString groupName, int inheritanceDepth = 700);
explicit CompletionCustomGroupNode(const QString& groupName, int inheritanceDepth = 700);
int inheritanceDepth;
};
......
......@@ -74,7 +74,7 @@ public:
//We connect directly, so we can do the pre-grouping within the background thread
connect(m_worker, &CodeCompletionWorker::foundDeclarationsReal, m_model, &CodeCompletionModel::foundDeclarations, Qt::QueuedConnection);
connect(m_model, &CodeCompletionModel::completionsNeeded, m_worker, static_cast<void(CodeCompletionWorker::*)(DUChainPointer<KDevelop::DUContext>,const Cursor&,View*)>(&CodeCompletionWorker::computeCompletions), Qt::QueuedConnection);
connect(m_model, &CodeCompletionModel::completionsNeeded, m_worker, static_cast<void(CodeCompletionWorker::*)(const DUChainPointer<KDevelop::DUContext>&, const Cursor&, View*)>(&CodeCompletionWorker::computeCompletions), Qt::QueuedConnection);
connect(m_model, &CodeCompletionModel::doSpecialProcessingInBackground, m_worker, &CodeCompletionWorker::doSpecialProcessing);
exec();
}
......@@ -368,7 +368,7 @@ KDevelop::TopDUContextPointer CodeCompletionModel::currentTopContext() const
return m_currentTopContext;
}
void CodeCompletionModel::setCurrentTopContext(KDevelop::TopDUContextPointer topContext)
void CodeCompletionModel::setCurrentTopContext(const KDevelop::TopDUContextPointer& topContext)
{
m_currentTopContext = topContext;
}
......
......@@ -83,7 +83,7 @@ class KDEVPLATFORMLANGUAGE_EXPORT CodeCompletionModel : public KTextEditor::Code
///Convenience-storage for use by the inherited completion model
KDevelop::TopDUContextPointer currentTopContext() const;
void setCurrentTopContext(KDevelop::TopDUContextPointer topContext);
void setCurrentTopContext(const KDevelop::TopDUContextPointer& topContext);
///Tracks navigation widget so they can be interactive with through the keyboard later on
void addNavigationWidget(const CompletionTreeElement* element, QWidget* widget) const;
......
......@@ -162,7 +162,7 @@ struct CodeCompletionItemTester
struct InsertIntoDUChain
{
///Artificially inserts a file called @p name with the text @p text
InsertIntoDUChain(QString name, QString text) : m_insertedCode(IndexedString(name), text), m_topContext(0) {
InsertIntoDUChain(const QString& name, const QString& text) : m_insertedCode(IndexedString(name), text), m_topContext(0) {
}
~InsertIntoDUChain() {
......@@ -199,7 +199,7 @@ struct InsertIntoDUChain
}
///Helper function: get a declaration based on its qualified identifier
Declaration* getDeclaration(QString id) {
Declaration* getDeclaration(const QString& id) {
get();
if(!topContext())
return 0;
......
......@@ -72,7 +72,7 @@ void CodeCompletionWorker::foundDeclarations(const QList<CompletionTreeElementPo
emit foundDeclarationsReal(items, completionContext);
}
void CodeCompletionWorker::computeCompletions(KDevelop::DUContextPointer context, const KTextEditor::Cursor& position, KTextEditor::View* view)
void CodeCompletionWorker::computeCompletions(const KDevelop::DUContextPointer& context, const KTextEditor::Cursor& position, KTextEditor::View* view)
{
{
QMutexLocker lock(m_mutex);
......@@ -196,7 +196,7 @@ QList<QExplicitlySharedDataPointer<CompletionTreeElement> > CodeCompletionWorker
* 2. Group by inheritance depth
* 3. Group by simplified attributes
* */
CodeCompletionItemGrouper<ArgumentHintDepthExtractor, CodeCompletionItemGrouper<InheritanceDepthExtractor, CodeCompletionItemGrouper<SimplifiedAttributesExtractor> > > argumentHintDepthGrouper(tree, nullptr, items);
CodeCompletionItemGrouper<ArgumentHintDepthExtractor, CodeCompletionItemGrouper<InheritanceDepthExtractor, CodeCompletionItemGrouper<SimplifiedAttributesExtractor> > > argumentHintDepthGrouper(tree, nullptr, std::move(items));
return tree;
}
......
......@@ -92,7 +92,7 @@ class KDEVPLATFORMLANGUAGE_EXPORT CodeCompletionWorker : public QObject
public Q_SLOTS:
///Connection from the foreground thread within CodeCompletionModel
void computeCompletions(KDevelop::DUContextPointer context, const KTextEditor::Cursor& position, KTextEditor::View* view);
void computeCompletions(const KDevelop::DUContextPointer& context, const KTextEditor::Cursor& position, KTextEditor::View* view);
///This can be used to do special processing within the background, completely bypassing the normal computeCompletions(..) etc. system.
///It will be executed within the background when the model emits doSpecialProcessingInBackground
virtual void doSpecialProcessing(uint data);
......
......@@ -42,7 +42,7 @@ const bool NormalDeclarationCompletionItem::shortenArgumentHintReturnValues = tr
const int NormalDeclarationCompletionItem::maximumArgumentHintReturnValueLength = 30;
const int NormalDeclarationCompletionItem::desiredTypeLength = 20;
NormalDeclarationCompletionItem::NormalDeclarationCompletionItem(KDevelop::DeclarationPointer decl, QExplicitlySharedDataPointer<CodeCompletionContext> context, int inheritanceDepth)
NormalDeclarationCompletionItem::NormalDeclarationCompletionItem(const KDevelop::DeclarationPointer& decl, QExplicitlySharedDataPointer<CodeCompletionContext> context, int inheritanceDepth)
: m_completionContext(context), m_declaration(decl), m_inheritanceDepth(inheritanceDepth) {
}
......
......@@ -31,7 +31,7 @@ namespace KDevelop {
class KDEVPLATFORMLANGUAGE_EXPORT NormalDeclarationCompletionItem : public CompletionTreeItem
{
public:
explicit NormalDeclarationCompletionItem(KDevelop::DeclarationPointer decl = KDevelop::DeclarationPointer(), QExplicitlySharedDataPointer<CodeCompletionContext> context=QExplicitlySharedDataPointer<CodeCompletionContext>(), int inheritanceDepth = 0);
explicit NormalDeclarationCompletionItem(const KDevelop::DeclarationPointer& decl = KDevelop::DeclarationPointer(), QExplicitlySharedDataPointer<CodeCompletionContext> context=QExplicitlySharedDataPointer<CodeCompletionContext>(), int inheritanceDepth = 0);
KDevelop::DeclarationPointer declaration() const override;
QExplicitlySharedDataPointer<CodeCompletionContext> completionContext() const;
int inheritanceDepth() const override;
......
......@@ -28,7 +28,7 @@ namespace KDevelop
//{
//}
DUChainChangeSet::DUChainChangeSet(ReferencedTopDUContext topContext) :
DUChainChangeSet::DUChainChangeSet(const ReferencedTopDUContext& topContext) :
m_topContext(topContext)
{
}
......
......@@ -173,7 +173,7 @@ public:
* \param topContext the top context of the read-only DUChain to modify, or set to null if creating
* a new DUChain from scratch.
*/
explicit DUChainChangeSet(ReferencedTopDUContext topContext);
explicit DUChainChangeSet(const ReferencedTopDUContext& topContext);
/**
* Destructor, deletes all objects, references and changes owned by this change set.
......
......@@ -44,13 +44,13 @@ AbstractType::Ptr DynamicLanguageExpressionVisitor::unknownType() const
return AbstractType::Ptr(new IntegralType(IntegralType::TypeMixed));
}
void DynamicLanguageExpressionVisitor::encounter(AbstractType::Ptr type, DeclarationPointer declaration)
void DynamicLanguageExpressionVisitor::encounter(AbstractType::Ptr type, const DeclarationPointer& declaration)
{
m_lastType = encounterPreprocess(type);
m_lastDeclaration = declaration;
}
void DynamicLanguageExpressionVisitor::encounterLvalue(DeclarationPointer lvalueDeclaration)
void DynamicLanguageExpressionVisitor::encounterLvalue(const DeclarationPointer& lvalueDeclaration)
{
m_lastDeclaration = lvalueDeclaration;
if ( lvalueDeclaration ) {
......
......@@ -163,7 +163,7 @@ public:
*
* @param lvalueDeclaration The declaration to set as last declaration and derive the last type from
*/
void encounterLvalue(DeclarationPointer lvalueDeclaration);
void encounterLvalue(const DeclarationPointer& lvalueDeclaration);
/**
* @brief Encounter the given type and declaration.
......@@ -172,7 +172,7 @@ public:
* @param type Type to set as the last type
* @param declaration Declaration to set as the last declaration; null by default
*/
void encounter(AbstractType::Ptr type, DeclarationPointer declaration=DeclarationPointer());
void encounter(AbstractType::Ptr type, const DeclarationPointer& declaration=DeclarationPointer());
/**
* @brief Set the last type to unknownType() and clear the last declaration.
......
......@@ -486,7 +486,7 @@ public:
}
///m_chainsMutex should _not_ be locked, because this may trigger I/O
QList<ParsingEnvironmentFilePointer> getEnvironmentInformation(IndexedString url) {
QList<ParsingEnvironmentFilePointer> getEnvironmentInformation(const IndexedString& url) {
QList<ParsingEnvironmentFilePointer> ret;
uint listIndex = m_environmentListInfo.findIndex(url);
......@@ -1042,7 +1042,7 @@ private:
}
///Stores the environment-information for the given url
void storeInformationList(IndexedString url) {
void storeInformationList(const IndexedString& url) {
QMutexLocker lock(m_environmentListInfo.mutex());
......
......@@ -613,7 +613,7 @@ DUContext* DUChainUtils::getFunctionContext(Declaration* decl) {
return nullptr;
}
QVector<KDevelop::Problem::Ptr> KDevelop::DUChainUtils::allProblemsForContext(KDevelop::ReferencedTopDUContext top)
QVector<KDevelop::Problem::Ptr> KDevelop::DUChainUtils::allProblemsForContext(const KDevelop::ReferencedTopDUContext& top)
{
QVector<KDevelop::Problem::Ptr> ret;
Q_FOREACH ( const auto& p, top->problems() ) {
......
......@@ -125,7 +125,7 @@ namespace DUChainUtils {
///and returns it.
KDEVPLATFORMLANGUAGE_EXPORT DUContext* getFunctionContext(Declaration* decl);
KDEVPLATFORMLANGUAGE_EXPORT QVector<KDevelop::Problem::Ptr> allProblemsForContext(ReferencedTopDUContext top);
KDEVPLATFORMLANGUAGE_EXPORT QVector<KDevelop::Problem::Ptr> allProblemsForContext(const ReferencedTopDUContext& top);
}
}
......
......@@ -59,7 +59,7 @@ QualifiedIdentifier InstantiationInformation::applyToIdentifier(const QualifiedI
return ret;
}
void InstantiationInformation::addTemplateParameter(KDevelop::AbstractType::Ptr type) {
void InstantiationInformation::addTemplateParameter(const KDevelop::AbstractType::Ptr& type) {
templateParametersList().append(IndexedType(type));
}
......
......@@ -109,7 +109,7 @@ namespace KDevelop {
*
* @warning Never use @c templateParametersList() directly.
*/
void addTemplateParameter(AbstractType::Ptr type);
void addTemplateParameter(const AbstractType::Ptr& type);
/**
* Instantiation-information for the surrounding context(see IndexedInstantiationInformation).
......
......@@ -406,7 +406,7 @@ void AbstractDeclarationNavigationContext::htmlFunction()
}
Identifier AbstractDeclarationNavigationContext::prettyIdentifier(DeclarationPointer decl) const
Identifier AbstractDeclarationNavigationContext::prettyIdentifier(const DeclarationPointer& decl) const
{
Identifier ret;
QualifiedIdentifier q = prettyQualifiedIdentifier(decl);
......@@ -425,7 +425,7 @@ QualifiedIdentifier AbstractDeclarationNavigationContext::prettyQualifiedIdentif
}
QString AbstractDeclarationNavigationContext::prettyQualifiedName(DeclarationPointer decl) const
QString AbstractDeclarationNavigationContext::prettyQualifiedName(const DeclarationPointer& decl) const
{
const auto qid = prettyQualifiedIdentifier(decl);
if (qid.isEmpty()) {
......@@ -526,7 +526,7 @@ void AbstractDeclarationNavigationContext::htmlAdditionalNavigation()
createFullBackwardSearchLink(inheriters.isEmpty() ? i18n("Inheriters possible, show all") : i18n("More inheriters possible, show all"));
}
void AbstractDeclarationNavigationContext::createFullBackwardSearchLink(QString string)
void AbstractDeclarationNavigationContext::createFullBackwardSearchLink(const QString& string)
{
makeLink(string, QStringLiteral("m_fullBackwardSearch=true"), NavigationAction(QStringLiteral("m_fullBackwardSearch=true")));
modifyHtml() += QStringLiteral("<br />");
......@@ -694,7 +694,7 @@ QString AbstractDeclarationNavigationContext::stringFromAccess(Declaration::Acce
return QString();
}
QString AbstractDeclarationNavigationContext::stringFromAccess(DeclarationPointer decl)
QString AbstractDeclarationNavigationContext::stringFromAccess(const DeclarationPointer& decl)
{
const ClassMemberDeclaration* memberDecl = dynamic_cast<const ClassMemberDeclaration*>(decl.data());
if( memberDecl ) {
......@@ -703,7 +703,7 @@ QString AbstractDeclarationNavigationContext::stringFromAccess(DeclarationPointe
return QString();
}
QString AbstractDeclarationNavigationContext::declarationName( DeclarationPointer decl ) const
QString AbstractDeclarationNavigationContext::declarationName( const DeclarationPointer& decl ) const
{
if( NamespaceAliasDeclaration* alias = dynamic_cast<NamespaceAliasDeclaration*>(decl.data()) ) {
if( alias->identifier().isEmpty() )
......@@ -718,7 +718,7 @@ QString AbstractDeclarationNavigationContext::declarationName( DeclarationPointe
return prettyIdentifier(decl).toString();
}
QStringList AbstractDeclarationNavigationContext::declarationDetails(DeclarationPointer decl)
QStringList AbstractDeclarationNavigationContext::declarationDetails(const DeclarationPointer& decl)
{
QStringList details;
const AbstractFunctionDeclaration* function = dynamic_cast<const AbstractFunctionDeclaration*>(decl.data());
......
......@@ -52,9 +52,9 @@ class KDEVPLATFORMLANGUAGE_EXPORT AbstractDeclarationNavigationContext : public
///Should returns a stripped version of the declarations qualified identifier, with all implicit/redundant parts removed
virtual QualifiedIdentifier prettyQualifiedIdentifier(DeclarationPointer decl) const;
///Returns a stripped version of the declarations identifier, using prettyQualifiedIdentifier
Identifier prettyIdentifier(DeclarationPointer decl) const;
Identifier prettyIdentifier(const DeclarationPointer& decl) const;
/// @return String version of the qualified identifier of @p decl, "<anonymous>" on an invalid QID
QString prettyQualifiedName(DeclarationPointer decl) const;
QString prettyQualifiedName(const DeclarationPointer& decl) const;
/**
* Return a rich-text version of the identifier @p identifier representing the declaration @p decl
......@@ -64,9 +64,9 @@ class KDEVPLATFORMLANGUAGE_EXPORT AbstractDeclarationNavigationContext : public
QString identifierHighlight(const QString& identifier, const DeclarationPointer& decl) const;
static QString stringFromAccess(Declaration::AccessPolicy access);
static QString stringFromAccess(DeclarationPointer decl);
QString declarationName( DeclarationPointer decl ) const;
static QStringList declarationDetails(DeclarationPointer decl);
static QString stringFromAccess(const DeclarationPointer& decl);
QString declarationName( const DeclarationPointer& decl ) const;
static QStringList declarationDetails(const DeclarationPointer& decl);
///This can be used for example to resolve typedefs within the type.
///All types that are visualized in the navigation-context are/should be mangled through this.
......@@ -85,7 +85,7 @@ class KDEVPLATFORMLANGUAGE_EXPORT AbstractDeclarationNavigationContext : public
virtual void eventuallyMakeTypeLinks( KDevelop::AbstractType::Ptr type );
///Creates a link that triggers a recomputation of this context with m_fullBackwardSearch set to true
void createFullBackwardSearchLink(QString string);
void createFullBackwardSearchLink(const QString& string);
private:
const QScopedPointer<class AbstractDeclarationNavigationContextPrivate> d;
......
......@@ -27,7 +27,7 @@
namespace KDevelop {
AbstractIncludeNavigationContext::AbstractIncludeNavigationContext(const IncludeItem& item,
TopDUContextPointer topContext,
const TopDUContextPointer& topContext,
const ParsingEnvironmentType& type)
: AbstractNavigationContext(topContext), m_type(type), m_item(item)
{}
......
......@@ -49,7 +49,7 @@ namespace KDevelop {
class KDEVPLATFORMLANGUAGE_EXPORT AbstractIncludeNavigationContext : public AbstractNavigationContext {
Q_OBJECT
public:
AbstractIncludeNavigationContext(const IncludeItem& item, TopDUContextPointer topContext,
AbstractIncludeNavigationContext(const IncludeItem& item, const TopDUContextPointer& topContext,
const ParsingEnvironmentType& type);
QString html(bool shorten) override;
QString name() const override;
......
......@@ -121,7 +121,7 @@ void AbstractNavigationContext::makeLink( const QString& name, DeclarationPointe
makeLink(name, QString(), action);
}
QString AbstractNavigationContext::createLink(const QString& name, QString, const NavigationAction& action)
QString AbstractNavigationContext::createLink(const QString& name, const QString&, const NavigationAction& action)
{
if(d->m_shorten) {
//Do not create links in shortened mode, it's only for viewing
......@@ -272,7 +272,7 @@ NavigationContextPointer AbstractNavigationContext::registerChild(AbstractNaviga
return d->m_children.last();
}
NavigationContextPointer AbstractNavigationContext::registerChild(DeclarationPointer declaration) {
NavigationContextPointer AbstractNavigationContext::registerChild(const DeclarationPointer& declaration) {
//We create a navigation-widget here, and steal its context.. evil ;)
QScopedPointer<QWidget> navigationWidget(declaration->context()->createNavigationWidget(declaration.data()));
if (AbstractNavigationWidget* abstractNavigationWidget = dynamic_cast<AbstractNavigationWidget*>(navigationWidget.data()) ) {
......@@ -495,7 +495,7 @@ QWidget* AbstractNavigationContext::widget() const {
}
///Splits the string by the given regular expression, but keeps the split-matches at the end of each line
static QStringList splitAndKeep(QString str, QRegExp regExp) {
static QStringList splitAndKeep(QString str, const QRegExp& regExp) {
QStringList ret;
int place = regExp.indexIn(str);
while(place != -1) {
......@@ -507,7 +507,7 @@ static QStringList splitAndKeep(QString str, QRegExp regExp) {
return ret;
}
void AbstractNavigationContext::addHtml(QString html) {
void AbstractNavigationContext::addHtml(const QString& html) {
QRegExp newLineRegExp("<br>|<br */>");
foreach(const QString& line, splitAndKeep(html, newLineRegExp)) {
d->m_currentText += line;
......
......@@ -131,7 +131,7 @@ public:
virtual NavigationContextPointer executeKeyAction(QString key);
///Adds given the text to currentHtml()
void addHtml(QString html);
void addHtml(const QString& html);
///Returns the html text being built in its current state
QString currentHtml() const;
///Returns a convenience object that allows writing "modifyHtml() += "Hallo";"
......@@ -151,9 +151,9 @@ public:
void makeLink( const QString& name, QString targetId, const NavigationAction& action);
///Creates a link that executes the given action and returns it
QString createLink(const QString& name, QString targetId, const NavigationAction& action);
QString createLink(const QString& name, const QString& targetId, const NavigationAction& action);
NavigationContextPointer registerChild(DeclarationPointer /*declaration*/);
NavigationContextPointer registerChild(const DeclarationPointer& /*declaration*/);
NavigationContextPointer registerChild(AbstractNavigationContext* context);
virtual QString declarationKind(DeclarationPointer decl);
......
......@@ -40,7 +40,7 @@
using namespace KDevelop;
///@todo make this language-neutral
static Identifier destructorForName(Identifier name) {
static Identifier destructorForName(const Identifier& name) {
QString str = name.identifier().str();
if(str.startsWith('~'))
return Identifier(str);
......@@ -322,7 +322,7 @@ void UsesCollector::progress(uint processed, uint total) {
Q_UNUSED(total);
}
void UsesCollector::updateReady(KDevelop::IndexedString url, KDevelop::ReferencedTopDUContext topContext) {
void UsesCollector::updateReady(const KDevelop::IndexedString& url, KDevelop::ReferencedTopDUContext topContext) {
DUChainReadLocker lock(DUChain::lock());
......
......@@ -89,7 +89,7 @@ namespace KDevelop {
///@see processUses()
void processUsesSignal(KDevelop::ReferencedTopDUContext);
private Q_SLOTS:
void updateReady(KDevelop::IndexedString url, KDevelop::ReferencedTopDUContext topContext);
void updateReady(const KDevelop::IndexedString& url, KDevelop::ReferencedTopDUContext topContext);
private:
///Called with every top-context that can contain uses of the declaration, or if setProcessDeclarations(false)
///has not been called also with all contexts that contain declarations used as base for the search.
......
......@@ -116,7 +116,7 @@ QString highlightAndEscapeUseText(QString line, int cutOff, KTextEditor::Range r
* Note: the links in the HTML here are only used for styling
* the navigation is implemented in the mouse press event handler
*/
OneUseWidget::OneUseWidget(IndexedDeclaration declaration, IndexedString document, KTextEditor::Range range, const CodeRepresentation& code) : m_range(new PersistentMovingRange(range, document)), m_declaration(declaration), m_document(document) {
OneUseWidget::OneUseWidget(IndexedDeclaration declaration, const IndexedString& document, KTextEditor::Range range, const CodeRepresentation& code) : m_range(new PersistentMovingRange(range, document)), m_declaration(declaration), m_document(document) {
//Make the sizing of this widget independent of the content, because we will adapt the content to the size
setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed);
......@@ -414,7 +414,7 @@ ContextUsesWidget::ContextUsesWidget(const CodeRepresentation& code, QList<Index
connect(headerLabel, &QLabel::linkActivated, this, &ContextUsesWidget::linkWasActivated);
}
void ContextUsesWidget::linkWasActivated(QString link) {
void ContextUsesWidget::linkWasActivated(const QString& link) {
if ( link == QLatin1String("navigateToFunction") ) {
DUChainReadLocker lock(DUChain::lock());
DUContext* context = m_context.context();
......@@ -488,7 +488,7 @@ int TopContextUsesWidget::usesCount() const
return m_usesCount;
}
QList<ContextUsesWidget*> buildContextUses(const CodeRepresentation& code, QList<IndexedDeclaration> declarations, DUContext* context) {
QList<ContextUsesWidget*> buildContextUses(const CodeRepresentation& code, const QList<IndexedDeclaration>& declarations, DUContext* context) {
QList<ContextUsesWidget*> ret;