Commit fbdbf1c0 authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau
Browse files

Use complete field initializing if not using empty {}

GIT_SILENT
parent 3bccedd3
Pipeline #30695 failed with stage
in 60 minutes and 1 second
......@@ -255,7 +255,7 @@ void OpenProjectDialog::validateOpenUrl( const QUrl& url_ )
auto plugins = projectManagerForFile(file);
if ( plugins.contains(QStringLiteral("<built-in>")) ) {
plugins.removeAll(QStringLiteral("<built-in>"));
choices.append({i18nc("@item:inlistbox", "Open existing file \"%1\"", file), QStringLiteral("<built-in>"), QString()});
choices.append({i18nc("@item:inlistbox", "Open existing file \"%1\"", file), QStringLiteral("<built-in>"), QString(), QString()});
}
choices.reserve(choices.size() + plugins.size());
for (const auto& plugin : qAsConst(plugins)) {
......@@ -268,7 +268,7 @@ void OpenProjectDialog::validateOpenUrl( const QUrl& url_ )
for (const auto& plugin : qAsConst(m_genericProjectPlugins)) {
qCDebug(SHELL) << plugin;
auto meta = m_projectPlugins.value(plugin);
choices.append({plugin, meta.pluginId(), meta.iconName()});
choices.append({plugin, meta.pluginId(), meta.iconName(), QString()});
}
page->populateProjectFileCombo(choices);
}
......
......@@ -385,7 +385,7 @@ ClangFixit directiveForFile( const QString& includefile, const KDevelop::Path::L
} else {
directive = QStringLiteral("#include <%1>").arg(shortestDirective);
}
return ClangFixit{directive + QLatin1Char('\n'), range, i18n("Insert \'%1\'", directive)};
return ClangFixit{directive + QLatin1Char('\n'), range, i18n("Insert \'%1\'", directive), QString()};
}
KDevelop::Path::List includePaths( const KDevelop::Path& file )
......@@ -445,13 +445,15 @@ ClangFixits forwardDeclarations(const QVector<Declaration*>& matchingDeclaration
case ClassDeclarationData::Class:
fixits += {
QLatin1String("class ") + name + QLatin1String(";\n"), range,
i18n("Forward declare as 'class'")
i18n("Forward declare as 'class'"),
QString()
};
break;
case ClassDeclarationData::Struct:
fixits += {
QLatin1String("struct ") + name + QLatin1String(";\n"), range,
i18n("Forward declare as 'struct'")
i18n("Forward declare as 'struct'"),
QString()
};
break;
default:
......
......@@ -213,7 +213,7 @@ void TestProblems::testFixits_data()
QTest::newRow("extra-tokens")
<< "#ifdef FOO\n#endif FOO\n"
<< 1
<< QVector<ClangFixit>{ ClangFixit{"//", DocumentRange(IndexedString(FileName), KTextEditor::Range(1, 7, 1, 7)), QString()} };
<< QVector<ClangFixit>{ ClangFixit{"//", DocumentRange(IndexedString(FileName), KTextEditor::Range(1, 7, 1, 7)), QString(), QString()} };
const auto clangVersion9OrHigher = QVersionNumber::fromString(ClangHelpers::clangVersion()) >= QVersionNumber(9, 0, 0);
// expected:
......@@ -325,8 +325,8 @@ void TestProblems::testMissingInclude_data()
<< "int main() { A a; }\n"
<< QString()
<< QVector<ClangFixit>{
ClangFixit{"class A;\n", DocumentRange(IndexedString(QDir::tempPath() + "/workingFile.h"), KTextEditor::Range(0, 0, 0, 0)), QString()},
ClangFixit{"#include \"includeFile.h\"\n", DocumentRange(IndexedString(QDir::tempPath() + "/workingFile.h"), KTextEditor::Range(0, 0, 0, 0)), QString()}
ClangFixit{"class A;\n", DocumentRange(IndexedString(QDir::tempPath() + "/workingFile.h"), KTextEditor::Range(0, 0, 0, 0)), QString(), QString()},
ClangFixit{"#include \"includeFile.h\"\n", DocumentRange(IndexedString(QDir::tempPath() + "/workingFile.h"), KTextEditor::Range(0, 0, 0, 0)), QString(), QString()}
};
// cf. bug 375274
......@@ -335,16 +335,16 @@ void TestProblems::testMissingInclude_data()
<< "#include <vector>\nint main() { Foo foo; }\n#include \"dummyInclude\"\n"
<< "/moc_fooXXXXXX.cpp"
<< QVector<ClangFixit>{
ClangFixit{"class Foo;\n", DocumentRange(IndexedString(QDir::tempPath() + "/workingFile.h"), KTextEditor::Range(0, 0, 0, 0)), QString()},
ClangFixit{"#include \"includeFile.h\"\n", DocumentRange(IndexedString(QDir::tempPath() + "/workingFile.h"), KTextEditor::Range(1, 0, 1, 0)), QString()}
ClangFixit{"class Foo;\n", DocumentRange(IndexedString(QDir::tempPath() + "/workingFile.h"), KTextEditor::Range(0, 0, 0, 0)), QString(), QString()},
ClangFixit{"#include \"includeFile.h\"\n", DocumentRange(IndexedString(QDir::tempPath() + "/workingFile.h"), KTextEditor::Range(1, 0, 1, 0)), QString(), QString()}
};
QTest::newRow("ignore-moc-at-end2")
<< "class Foo {};\n"
<< "int main() { Foo foo; }\n#include \"dummyInclude\"\n"
<< "/fooXXXXXX.moc"
<< QVector<ClangFixit>{
ClangFixit{"class Foo;\n", DocumentRange(IndexedString(QDir::tempPath() + "/workingFile.h"), KTextEditor::Range(0, 0, 0, 0)), QString()},
ClangFixit{"#include \"includeFile.h\"\n", DocumentRange(IndexedString(QDir::tempPath() + "/workingFile.h"), KTextEditor::Range(0, 0, 0, 0)), QString()}
ClangFixit{"class Foo;\n", DocumentRange(IndexedString(QDir::tempPath() + "/workingFile.h"), KTextEditor::Range(0, 0, 0, 0)), QString(), QString()},
ClangFixit{"#include \"includeFile.h\"\n", DocumentRange(IndexedString(QDir::tempPath() + "/workingFile.h"), KTextEditor::Range(0, 0, 0, 0)), QString(), QString()}
};
}
......
......@@ -112,7 +112,15 @@ ImportData import(const Path& commandsFile, const Path &targetsFilePath, const Q
//we don't have target type information in json, so we just announce all of them as exes
const auto targets = CMake::enumerateTargets(targetsFilePath, sourceDir, buildPath);
for(auto it = targets.constBegin(), itEnd = targets.constEnd(); it!=itEnd; ++it) {
cmakeTargets[it.key()] = kTransform<QVector<CMakeTarget>>(*it, [](const QString &targetName) { return CMakeTarget{CMakeTarget::Executable, targetName}; });
cmakeTargets[it.key()] = kTransform<QVector<CMakeTarget>>(*it, [](const QString &targetName) {
return CMakeTarget{
CMakeTarget::Executable,
targetName,
KDevelop::Path::List(),
KDevelop::Path::List(),
QString()
};
});
}
return ImportData {
......@@ -168,7 +176,7 @@ void CMakeImportJsonJob::importCompileCommandsJsonFinished()
return;
}
m_data = {data.compilationData, data.targets, data.testSuites};
m_data = {data.compilationData, data.targets, data.testSuites, {}};
qCDebug(CMAKE) << "Done importing, found" << data.compilationData.files.count() << "entries for" << project()->path();
emitResult();
......
......@@ -96,6 +96,7 @@ void CMakeServerImportJob::processCodeModel(const QJsonObject &response, CMakePr
target.value(QStringLiteral("name")).toString(),
kTransform<KDevelop::Path::List>(target[QLatin1String("artifacts")].toArray(), [](const QJsonValue& val) { return KDevelop::Path(val.toString()); }),
targetSources,
QString()
};
// ensure we don't add the same target multiple times, for different projects
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment