aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/git
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-10-07 14:46:06 +0200
committerMarc Mutz <marc.mutz@qt.io>2022-10-07 13:47:53 +0000
commit8eb4d52342fe3a6ede1c1dce3174d95bfa0cea88 (patch)
tree0f5556c5e4098e75853e3d9ee2620e0306f0cf2a /src/plugins/git
parent90de29d530dfc2921d5179977b3393c11a3cc238 (diff)
Port from qAsConst() to std::as_const()
We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace. Task-number: QTBUG-99313 Change-Id: I88edd91395849574436299b8badda21bb93bea39 Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/plugins/git')
-rw-r--r--src/plugins/git/branchmodel.cpp4
-rw-r--r--src/plugins/git/branchview.cpp4
-rw-r--r--src/plugins/git/gerrit/gerritmodel.cpp2
-rw-r--r--src/plugins/git/gerrit/gerritremotechooser.cpp2
-rw-r--r--src/plugins/git/gitclient.cpp6
-rw-r--r--src/plugins/git/gitgrep.cpp2
-rw-r--r--src/plugins/git/githighlighters.cpp2
-rw-r--r--src/plugins/git/gitplugin.cpp6
8 files changed, 14 insertions, 14 deletions
diff --git a/src/plugins/git/branchmodel.cpp b/src/plugins/git/branchmodel.cpp
index c262f07c0b..4deefcb734 100644
--- a/src/plugins/git/branchmodel.cpp
+++ b/src/plugins/git/branchmodel.cpp
@@ -127,7 +127,7 @@ public:
fn.append(nodes.first()->sha);
nodes.removeFirst();
- for (const BranchNode *n : qAsConst(nodes))
+ for (const BranchNode *n : std::as_const(nodes))
fn.append(n->name);
return fn;
@@ -390,7 +390,7 @@ Qt::ItemFlags BranchModel::flags(const QModelIndex &index) const
void BranchModel::clear()
{
- for (BranchNode *root : qAsConst(d->rootNode->children)) {
+ for (BranchNode *root : std::as_const(d->rootNode->children)) {
while (root->count())
delete root->children.takeLast();
}
diff --git a/src/plugins/git/branchview.cpp b/src/plugins/git/branchview.cpp
index eb8d5ad86e..bc4f48277a 100644
--- a/src/plugins/git/branchview.cpp
+++ b/src/plugins/git/branchview.cpp
@@ -392,7 +392,7 @@ bool BranchView::checkout()
QList<Stash> stashes;
client->synchronousStashList(m_repository, &stashes);
- for (const Stash &stash : qAsConst(stashes)) {
+ for (const Stash &stash : std::as_const(stashes)) {
if (stash.message.startsWith(popMessageStart)) {
branchCheckoutDialog.foundStashForNextBranch();
break;
@@ -428,7 +428,7 @@ bool BranchView::checkout()
QList<Stash> stashes;
QString stashName;
client->synchronousStashList(m_repository, &stashes);
- for (const Stash &stash : qAsConst(stashes)) {
+ for (const Stash &stash : std::as_const(stashes)) {
if (stash.message.startsWith(popMessageStart)) {
stashName = stash.name;
break;
diff --git a/src/plugins/git/gerrit/gerritmodel.cpp b/src/plugins/git/gerrit/gerritmodel.cpp
index 9691a8266a..cd4857edeb 100644
--- a/src/plugins/git/gerrit/gerritmodel.cpp
+++ b/src/plugins/git/gerrit/gerritmodel.cpp
@@ -908,7 +908,7 @@ void GerritModel::resultRetrieved(const QByteArray &output)
std::stable_sort(changes.begin(), changes.end(), gerritChangeLessThan);
numberIndexHash.clear();
- for (const GerritChangePtr &c : qAsConst(changes)) {
+ for (const GerritChangePtr &c : std::as_const(changes)) {
// Avoid duplicate entries for example in the (unlikely)
// case people do self-reviews.
if (!itemForNumber(c->number)) {
diff --git a/src/plugins/git/gerrit/gerritremotechooser.cpp b/src/plugins/git/gerrit/gerritremotechooser.cpp
index df628194ba..2d319bc8cb 100644
--- a/src/plugins/git/gerrit/gerritremotechooser.cpp
+++ b/src/plugins/git/gerrit/gerritremotechooser.cpp
@@ -103,7 +103,7 @@ bool GerritRemoteChooser::updateRemotes(bool forceReload)
void GerritRemoteChooser::addRemote(const GerritServer &server, const QString &name)
{
if (!m_allowDups) {
- for (const auto &remote : qAsConst(m_remotes)) {
+ for (const auto &remote : std::as_const(m_remotes)) {
if (remote.second == server)
return;
}
diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp
index 386549993f..002d603a43 100644
--- a/src/plugins/git/gitclient.cpp
+++ b/src/plugins/git/gitclient.cpp
@@ -1796,7 +1796,7 @@ QString GitClient::synchronousTopic(const FilePath &workingDirectory) const
const QString dereference("^{}");
QString remoteBranch;
- for (const QString &ref : qAsConst(references)) {
+ for (const QString &ref : std::as_const(references)) {
int derefInd = ref.indexOf(dereference);
if (ref.startsWith(tagStart))
return ref.mid(tagStart.size(), (derefInd == -1) ? -1 : derefInd - tagStart.size());
@@ -1968,7 +1968,7 @@ bool GitClient::stashNameFromMessage(const FilePath &workingDirectory,
QList<Stash> stashes;
if (!synchronousStashList(workingDirectory, &stashes, errorMessage))
return false;
- for (const Stash &s : qAsConst(stashes)) {
+ for (const Stash &s : std::as_const(stashes)) {
if (s.message == message) {
*name = s.name;
return true;
@@ -2321,7 +2321,7 @@ void GitClient::updateSubmodulesIfNeeded(const FilePath &workingDirectory, bool
void GitClient::finishSubmoduleUpdate()
{
- for (const FilePath &submoduleDir : qAsConst(m_updatedSubmodules))
+ for (const FilePath &submoduleDir : std::as_const(m_updatedSubmodules))
endStashScope(submoduleDir);
m_updatedSubmodules.clear();
}
diff --git a/src/plugins/git/gitgrep.cpp b/src/plugins/git/gitgrep.cpp
index 1e0fc3f131..243952c2d4 100644
--- a/src/plugins/git/gitgrep.cpp
+++ b/src/plugins/git/gitgrep.cpp
@@ -108,7 +108,7 @@ public:
}
single.matchingLine = text;
- for (const auto &match : qAsConst(matches)) {
+ for (const auto &match : std::as_const(matches)) {
single.matchStart = match.matchStart;
single.matchLength = match.matchLength;
single.regexpCapturedTexts = match.regexpCapturedTexts;
diff --git a/src/plugins/git/githighlighters.cpp b/src/plugins/git/githighlighters.cpp
index a3b7547f08..046a8b0c66 100644
--- a/src/plugins/git/githighlighters.cpp
+++ b/src/plugins/git/githighlighters.cpp
@@ -138,7 +138,7 @@ void GitRebaseHighlighter::highlightBlock(const QString &text)
setFormat(match.capturedStart(), match.capturedLength(), formatForCategory(Format_Change));
}
} else {
- for (const RebaseAction &action : qAsConst(m_actions)) {
+ for (const RebaseAction &action : std::as_const(m_actions)) {
const QRegularExpressionMatch match = action.exp.match(text);
if (match.hasMatch()) {
const int len = match.capturedLength();
diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp
index 4a19145300..f2e277a755 100644
--- a/src/plugins/git/gitplugin.cpp
+++ b/src/plugins/git/gitplugin.cpp
@@ -1689,15 +1689,15 @@ void GitPluginPrivate::updateActions(VcsBasePluginPrivate::ActionState as)
// Note: This menu is visible if there is no repository. Only
// 'Create Repository'/'Show' actions should be available.
const QString fileName = Utils::quoteAmpersands(state.currentFileName());
- for (ParameterAction *fileAction : qAsConst(m_fileActions))
+ for (ParameterAction *fileAction : std::as_const(m_fileActions))
fileAction->setParameter(fileName);
// If the current file looks like a patch, offer to apply
m_applyCurrentFilePatchAction->setParameter(state.currentPatchFileDisplayName());
const QString projectName = state.currentProjectName();
- for (ParameterAction *projectAction : qAsConst(m_projectActions))
+ for (ParameterAction *projectAction : std::as_const(m_projectActions))
projectAction->setParameter(projectName);
- for (QAction *repositoryAction : qAsConst(m_repositoryActions))
+ for (QAction *repositoryAction : std::as_const(m_repositoryActions))
repositoryAction->setEnabled(repositoryEnabled);
m_submoduleUpdateAction->setVisible(repositoryEnabled