forked from qt-creator/qt-creator
CppEditor: Remove foreach / Q_FOREACH usage part 2
Task-number: QTCREATORBUG-27464 Change-Id: I352bf37bd017e7381fbd7b050fbb55c9a73bd668 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
@@ -91,7 +91,7 @@ BaseQuickFixTestCase::BaseQuickFixTestCase(const QList<TestDocumentPtr> &testDoc
|
||||
|
||||
// Check if there is exactly one cursor marker
|
||||
unsigned cursorMarkersCount = 0;
|
||||
foreach (const TestDocumentPtr document, m_testDocuments) {
|
||||
for (const TestDocumentPtr &document : qAsConst(m_testDocuments)) {
|
||||
if (document->hasCursorMarker())
|
||||
++cursorMarkersCount;
|
||||
}
|
||||
@@ -100,7 +100,7 @@ BaseQuickFixTestCase::BaseQuickFixTestCase(const QList<TestDocumentPtr> &testDoc
|
||||
// Write documents to disk
|
||||
m_temporaryDirectory.reset(new TemporaryDir);
|
||||
QVERIFY(m_temporaryDirectory->isValid());
|
||||
foreach (TestDocumentPtr document, m_testDocuments) {
|
||||
for (const TestDocumentPtr &document : qAsConst(m_testDocuments)) {
|
||||
if (QFileInfo(document->m_fileName).isRelative())
|
||||
document->setBaseDirectory(m_temporaryDirectory->path());
|
||||
document->writeToDisk();
|
||||
@@ -115,12 +115,12 @@ BaseQuickFixTestCase::BaseQuickFixTestCase(const QList<TestDocumentPtr> &testDoc
|
||||
|
||||
// Update Code Model
|
||||
QSet<QString> filePaths;
|
||||
foreach (const TestDocumentPtr &document, m_testDocuments)
|
||||
for (const TestDocumentPtr &document : qAsConst(m_testDocuments))
|
||||
filePaths << document->filePath();
|
||||
QVERIFY(parseFiles(filePaths));
|
||||
|
||||
// Open Files
|
||||
foreach (TestDocumentPtr document, m_testDocuments) {
|
||||
for (const TestDocumentPtr &document : qAsConst(m_testDocuments)) {
|
||||
QVERIFY(openCppEditor(document->filePath(), &document->m_editor,
|
||||
&document->m_editorWidget));
|
||||
closeEditorAtEndOfTestCase(document->m_editor);
|
||||
@@ -149,7 +149,7 @@ BaseQuickFixTestCase::BaseQuickFixTestCase(const QList<TestDocumentPtr> &testDoc
|
||||
m_cppCodeStylePreferences->setCurrentDelegate("qt");
|
||||
|
||||
// Find the document having the cursor marker
|
||||
foreach (const TestDocumentPtr document, m_testDocuments) {
|
||||
for (const TestDocumentPtr &document : qAsConst(m_testDocuments)) {
|
||||
if (document->hasCursorMarker()){
|
||||
m_documentWithMarker = document;
|
||||
break;
|
||||
@@ -171,7 +171,7 @@ BaseQuickFixTestCase::~BaseQuickFixTestCase()
|
||||
m_modelManager->setHeaderPaths(m_headerPathsToRestore);
|
||||
|
||||
// Remove created files from file system
|
||||
foreach (const TestDocumentPtr &testDocument, m_testDocuments)
|
||||
for (const TestDocumentPtr &testDocument : qAsConst(m_testDocuments))
|
||||
QVERIFY(QFile::remove(testDocument->filePath()));
|
||||
}
|
||||
|
||||
@@ -223,7 +223,7 @@ QuickFixOperationTest::QuickFixOperationTest(const QList<TestDocumentPtr> &testD
|
||||
operation->perform();
|
||||
|
||||
// Compare all files
|
||||
foreach (const TestDocumentPtr testDocument, m_testDocuments) {
|
||||
for (const TestDocumentPtr &testDocument : qAsConst(m_testDocuments)) {
|
||||
// Check
|
||||
QString result = testDocument->m_editorWidget->document()->toPlainText();
|
||||
removeTrailingWhitespace(result);
|
||||
@@ -269,7 +269,7 @@ QuickFixOfferedOperationsTest::QuickFixOfferedOperationsTest(
|
||||
|
||||
// Convert to QStringList
|
||||
QStringList actualOperationsAsStringList;
|
||||
foreach (const QuickFixOperation::Ptr &operation, actualOperations)
|
||||
for (const QuickFixOperation::Ptr &operation : qAsConst(actualOperations))
|
||||
actualOperationsAsStringList << operation->description();
|
||||
|
||||
QCOMPARE(actualOperationsAsStringList, expectedOperations);
|
||||
@@ -5874,7 +5874,7 @@ void QuickfixTest::testAddIncludeForUndefinedIdentifier()
|
||||
|
||||
TemporaryDir temporaryDir;
|
||||
QVERIFY(temporaryDir.isValid());
|
||||
foreach (TestDocumentPtr testDocument, testDocuments)
|
||||
for (const TestDocumentPtr &testDocument : qAsConst(testDocuments))
|
||||
testDocument->setBaseDirectory(temporaryDir.path());
|
||||
|
||||
QScopedPointer<CppQuickFixFactory> factory;
|
||||
|
||||
Reference in New Issue
Block a user