Commit 97496df1 authored by Tobias Hunger's avatar Tobias Hunger
Browse files

Task: Update Task to use Utils::FileName and Core::Id



Use Utils::FileName and Core::Id in Task structure.

Change-Id: Ia0ed459f86df36ffe547abde7c240b0ac409bcf5
Reviewed-by: default avatarDaniel Teske <daniel.teske@nokia.com>
parent 2f021edf
......@@ -86,7 +86,7 @@ bool AnalyzerPlugin::initialize(const QStringList &arguments, QString *errorStri
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
ProjectExplorer::TaskHub *hub = pm->getObject<ProjectExplorer::TaskHub>();
//: Category under which Analyzer tasks are listed in Issues view
hub->addCategory(QLatin1String(Constants::ANALYZERTASK_ID), tr("Analyzer"));
hub->addCategory(Core::Id(Constants::ANALYZERTASK_ID), tr("Analyzer"));
return true;
}
......
......@@ -118,7 +118,7 @@ void AnalyzerRunControl::start()
// clear about-to-be-outdated tasks
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
TaskHub *hub = pm->getObject<TaskHub>();
hub->clearTasks(QLatin1String(Constants::ANALYZERTASK_ID));
hub->clearTasks(Core::Id(Constants::ANALYZERTASK_ID));
if (d->m_engine->start()) {
d->m_isRunning = true;
......@@ -179,7 +179,8 @@ void AnalyzerRunControl::addTask(Task::TaskType type, const QString &description
{
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
TaskHub *hub = pm->getObject<TaskHub>();
hub->addTask(Task(type, description, file, line, QLatin1String(Constants::ANALYZERTASK_ID)));
hub->addTask(Task(type, description, Utils::FileName::fromUserInput(file), line,
Core::Id(Constants::ANALYZERTASK_ID)));
hub->popup(false);
}
......
......@@ -55,7 +55,7 @@ static QHash<QByteArray, int> idFromString;
static int theId(const QByteArray &ba)
{
QTC_ASSERT(!ba.isEmpty(), /**/);
QTC_CHECK(!ba.isEmpty());
int res = idFromString.value(ba);
if (res == 0) {
if (lastUid == 0)
......
......@@ -1787,10 +1787,10 @@ void DebuggerEnginePrivate::reportTestError(const QString &msg, int line)
if (!m_taskHub) {
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
m_taskHub = pm->getObject<TaskHub>();
m_taskHub->addCategory(QLatin1String("DebuggerTest"), tr("Debugger Test"));
m_taskHub->addCategory(Core::Id("DebuggerTest"), tr("Debugger Test"));
}
Task task(Task::Error, msg, m_testFileName, line + 1, QLatin1String("DebuggerTest"));
Task task(Task::Error, msg, Utils::FileName::fromUserInput(m_testFileName), line + 1, Core::Id("DebuggerTest"));
m_taskHub->addTask(task);
}
......
......@@ -367,7 +367,7 @@ void MaemoDebianPackageCreationStep::checkProjectName()
"Debian packages.\nThey must only use lower-case letters, "
"numbers, '-', '+' and '.'.\n""We will try to work around that, "
"but you may experience problems."),
QString(), -1, TASK_CATEGORY_BUILDSYSTEM));
Utils::FileName(), -1, Core::Id(TASK_CATEGORY_BUILDSYSTEM)));
}
}
......
......@@ -371,7 +371,7 @@ void AbstractProcessStep::taskAdded(const ProjectExplorer::Task &task)
return;
Task editable(task);
QString filePath = QDir::cleanPath(task.file.trimmed());
QString filePath = task.file.toString();
if (!filePath.isEmpty() && !QDir::isAbsolutePath(filePath)) {
// We have no save way to decide which file in which subfolder
// is meant. Therefore we apply following heuristics:
......@@ -388,7 +388,7 @@ void AbstractProcessStep::taskAdded(const ProjectExplorer::Task &task)
}
if (possibleFiles.count() == 1) {
editable.file = possibleFiles.first().filePath();
editable.file = Utils::FileName(possibleFiles.first());
} else {
// More then one filename, so do a better compare
// Chop of any "../"
......@@ -403,7 +403,7 @@ void AbstractProcessStep::taskAdded(const ProjectExplorer::Task &task)
}
}
if (count == 1)
editable.file = possibleFilePath;
editable.file = Utils::FileName::fromString(possibleFilePath);
else
qWarning() << "Could not find absolute location of file " << filePath;
}
......
......@@ -159,9 +159,9 @@ BuildManager::BuildManager(ProjectExplorerPlugin *parent)
void BuildManager::extensionsInitialized()
{
d->m_taskHub->addCategory(QLatin1String(Constants::TASK_CATEGORY_COMPILE),
d->m_taskHub->addCategory(Core::Id(Constants::TASK_CATEGORY_COMPILE),
tr("Compile", "Category for compiler issues listed under 'Issues'"));
d->m_taskHub->addCategory(QLatin1String(Constants::TASK_CATEGORY_BUILDSYSTEM),
d->m_taskHub->addCategory(Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM),
tr("Build System", "Category for build system issues listed under 'Issues'"));
}
......@@ -200,8 +200,8 @@ bool BuildManager::isBuilding() const
int BuildManager::getErrorTaskCount() const
{
const int errors =
d->m_taskWindow->errorTaskCount(QLatin1String(Constants::TASK_CATEGORY_BUILDSYSTEM))
+ d->m_taskWindow->errorTaskCount(QLatin1String(Constants::TASK_CATEGORY_COMPILE));
d->m_taskWindow->errorTaskCount(Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM))
+ d->m_taskWindow->errorTaskCount(Core::Id(Constants::TASK_CATEGORY_COMPILE));
return errors;
}
......@@ -305,8 +305,8 @@ void BuildManager::toggleTaskWindow()
bool BuildManager::tasksAvailable() const
{
const int count =
d->m_taskWindow->taskCount(QLatin1String(Constants::TASK_CATEGORY_BUILDSYSTEM))
+ d->m_taskWindow->taskCount(QLatin1String(Constants::TASK_CATEGORY_COMPILE));
d->m_taskWindow->taskCount(Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM))
+ d->m_taskWindow->taskCount(Core::Id(Constants::TASK_CATEGORY_COMPILE));
return count > 0;
}
......@@ -322,8 +322,8 @@ void BuildManager::startBuildQueue()
d->m_progressFutureInterface = new QFutureInterface<void>;
d->m_progressWatcher.setFuture(d->m_progressFutureInterface->future());
d->m_outputWindow->clearContents();
d->m_taskHub->clearTasks(QLatin1String(Constants::TASK_CATEGORY_COMPILE));
d->m_taskHub->clearTasks(QLatin1String(Constants::TASK_CATEGORY_BUILDSYSTEM));
d->m_taskHub->clearTasks(Core::Id(Constants::TASK_CATEGORY_COMPILE));
d->m_taskHub->clearTasks(Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM));
progressManager->setApplicationLabel(QString());
d->m_futureProgress = QWeakPointer<Core::FutureProgress>(progressManager->addTask(d->m_progressFutureInterface->future(),
QString(),
......
......@@ -89,8 +89,8 @@ void BuildProgress::updateState()
{
if (!m_taskWindow)
return;
int errors = m_taskWindow->errorTaskCount(QLatin1String(Constants::TASK_CATEGORY_BUILDSYSTEM))
+ m_taskWindow->errorTaskCount(QLatin1String(Constants::TASK_CATEGORY_COMPILE));
int errors = m_taskWindow->errorTaskCount(Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM))
+ m_taskWindow->errorTaskCount(Core::Id(Constants::TASK_CATEGORY_COMPILE));
bool haveErrors = (errors > 0);
m_errorIcon->setEnabled(haveErrors);
m_errorLabel->setEnabled(haveErrors);
......
......@@ -72,9 +72,9 @@ void ClangParser::stdError(const QString &line)
m_expectSnippet = true;
newTask(Task::Error,
m_commandRegExp.cap(4),
QString(), /* filename */
Utils::FileName(), /* filename */
-1, /* line */
QLatin1String(Constants::TASK_CATEGORY_COMPILE));
Core::Id(Constants::TASK_CATEGORY_COMPILE));
if (m_commandRegExp.cap(3) == QLatin1String("warning"))
m_currentTask.type = Task::Warning;
else if (m_commandRegExp.cap(3) == QLatin1String("note"))
......@@ -86,9 +86,9 @@ void ClangParser::stdError(const QString &line)
m_expectSnippet = true;
newTask(Task::Unknown,
lne.trimmed(),
m_inLineRegExp.cap(2), /* filename */
Utils::FileName::fromUserInput(m_inLineRegExp.cap(2)), /* filename */
m_inLineRegExp.cap(3).toInt(), /* line */
QLatin1String(Constants::TASK_CATEGORY_COMPILE));
Core::Id(Constants::TASK_CATEGORY_COMPILE));
return;
}
......@@ -100,9 +100,9 @@ void ClangParser::stdError(const QString &line)
lineNo = m_messageRegExp.cap(5).toInt(&ok);
newTask(Task::Error,
m_messageRegExp.cap(8),
m_messageRegExp.cap(1), /* filename */
Utils::FileName::fromUserInput(m_messageRegExp.cap(1)), /* filename */
lineNo,
QLatin1String(Constants::TASK_CATEGORY_COMPILE));
Core::Id(Constants::TASK_CATEGORY_COMPILE));
if (m_messageRegExp.cap(7) == QLatin1String("warning"))
m_currentTask.type = Task::Warning;
else if (m_messageRegExp.cap(7) == QLatin1String("note"))
......@@ -126,7 +126,7 @@ void ClangParser::stdError(const QString &line)
}
void ClangParser::newTask(Task::TaskType type_, const QString &description_,
const QString &file_, int line_, const QString &category_)
const Utils::FileName &file_, int line_, const Core::Id &category_)
{
emitTask();
m_currentTask = Task(type_, description_, file_, line_, category_);
......@@ -157,7 +157,7 @@ void ProjectExplorerPlugin::testClangOutputParser_data()
QTest::addColumn<QList<ProjectExplorer::Task> >("tasks");
QTest::addColumn<QString>("outputLines");
const QString categoryCompile = QLatin1String(Constants::TASK_CATEGORY_COMPILE);
const Core::Id categoryCompile = Core::Id(Constants::TASK_CATEGORY_COMPILE);
QTest::newRow("pass-through stdout")
<< QString::fromLatin1("Sometext") << OutputParserTester::STDOUT
......@@ -177,7 +177,7 @@ void ProjectExplorerPlugin::testClangOutputParser_data()
<< (QList<ProjectExplorer::Task>()
<< Task(Task::Warning,
QLatin1String("argument unused during compilation: '-mthreads'"),
QString(), -1,
Utils::FileName(), -1,
categoryCompile))
<< QString();
QTest::newRow("clang++ error")
......@@ -187,7 +187,7 @@ void ProjectExplorerPlugin::testClangOutputParser_data()
<< (QList<ProjectExplorer::Task>()
<< Task(Task::Error,
QLatin1String("no input files [err_drv_no_input_files]"),
QString(), -1,
Utils::FileName(), -1,
categoryCompile))
<< QString();
QTest::newRow("complex warning")
......@@ -200,13 +200,13 @@ void ProjectExplorerPlugin::testClangOutputParser_data()
<< (QList<ProjectExplorer::Task>()
<< Task(Task::Unknown,
QLatin1String("In file included from ..\\..\\..\\QtSDK1.1\\Desktop\\Qt\\4.7.3\\mingw\\include/QtCore/qnamespace.h:45:"),
QLatin1String("..\\..\\..\\QtSDK1.1\\Desktop\\Qt\\4.7.3\\mingw\\include/QtCore/qnamespace.h"), 45,
Utils::FileName::fromUserInput("..\\..\\..\\QtSDK1.1\\Desktop\\Qt\\4.7.3\\mingw\\include/QtCore/qnamespace.h"), 45,
categoryCompile)
<< Task(Task::Warning,
QLatin1String("unknown attribute 'dllimport' ignored [-Wunknown-attributes]\n"
"class Q_CORE_EXPORT QSysInfo {\n"
" ^"),
QLatin1String("..\\..\\..\\QtSDK1.1\\Desktop\\Qt\\4.7.3\\mingw\\include/QtCore/qglobal.h"), 1425,
Utils::FileName::fromUserInput("..\\..\\..\\QtSDK1.1\\Desktop\\Qt\\4.7.3\\mingw\\include/QtCore/qglobal.h"), 1425,
categoryCompile))
<< QString();
QTest::newRow("note")
......@@ -220,7 +220,7 @@ void ProjectExplorerPlugin::testClangOutputParser_data()
QLatin1String("instantiated from:\n"
"# define Q_CORE_EXPORT Q_DECL_IMPORT\n"
" ^"),
QLatin1String("..\\..\\..\\QtSDK1.1\\Desktop\\Qt\\4.7.3\\mingw\\include/QtCore/qglobal.h"), 1289,
Utils::FileName::fromUserInput("..\\..\\..\\QtSDK1.1\\Desktop\\Qt\\4.7.3\\mingw\\include/QtCore/qglobal.h"), 1289,
categoryCompile))
<< QString();
QTest::newRow("fatal error")
......@@ -234,7 +234,7 @@ void ProjectExplorerPlugin::testClangOutputParser_data()
QLatin1String("'bits/c++config.h' file not found\n"
"#include <bits/c++config.h>\n"
" ^"),
QLatin1String("/usr/include/c++/4.6/utility"), 68,
Utils::FileName::fromUserInput("/usr/include/c++/4.6/utility"), 68,
categoryCompile))
<< QString();
......@@ -249,7 +249,7 @@ void ProjectExplorerPlugin::testClangOutputParser_data()
QLatin1String("?: has lower precedence than +; + will be evaluated first [-Wparentheses]\n"
" int x = option->rect.x() + horizontal ? 2 : 6;\n"
" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^"),
QLatin1String("/home/code/src/creator/src/plugins/coreplugin/manhattanstyle.cpp"), 567,
Utils::FileName::fromUserInput("/home/code/src/creator/src/plugins/coreplugin/manhattanstyle.cpp"), 567,
categoryCompile))
<< QString();
}
......
......@@ -51,7 +51,7 @@ public:
private:
void newTask(Task::TaskType type_, const QString &description_,
const QString &file_, int line_, const QString &category_);
const Utils::FileName &file_, int line_, const Core::Id &category_);
void emitTask();
......
......@@ -63,7 +63,7 @@ void CopyTaskHandler::handle(const ProjectExplorer::Task &task)
break;
}
QApplication::clipboard()->setText(QDir::toNativeSeparators(task.file) + QLatin1Char(':') +
QApplication::clipboard()->setText(task.file.toUserOutput() + QLatin1Char(':') +
QString::number(task.line) + QLatin1String(": ")
+ type + task.description);
}
......
This diff is collapsed.
......@@ -95,9 +95,9 @@ void GnuMakeParser::stdError(const QString &line)
m_suppressIssues = true;
addTask(Task(Task::Error,
m_makefileError.cap(3),
m_makefileError.cap(1),
Utils::FileName::fromUserInput(m_makefileError.cap(1)),
m_makefileError.cap(2).toInt(),
QLatin1String(Constants::TASK_CATEGORY_BUILDSYSTEM)));
Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM)));
}
return;
}
......@@ -108,9 +108,9 @@ void GnuMakeParser::stdError(const QString &line)
m_suppressIssues = true;
addTask(Task(Task::Error,
m_makeLine.cap(8),
QString() /* filename */,
Utils::FileName() /* filename */,
-1, /* line */
QLatin1String(Constants::TASK_CATEGORY_BUILDSYSTEM)));
Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM)));
}
return;
}
......@@ -139,7 +139,7 @@ void GnuMakeParser::taskAdded(const Task &task)
m_suppressIssues = true;
}
QString filePath(QDir::cleanPath(task.file.trimmed()));
QString filePath(task.file.toString());
if (!filePath.isEmpty() && !QDir::isAbsolutePath(filePath)) {
QList<QFileInfo> possibleFiles;
......@@ -151,7 +151,7 @@ void GnuMakeParser::taskAdded(const Task &task)
}
}
if (possibleFiles.size() == 1)
editable.file = possibleFiles.first().filePath();
editable.file = Utils::FileName(possibleFiles.first());
// Let the Makestep apply additional heuristics (based on
// files in ther project) if we can not uniquely
// identify the file!
......@@ -261,8 +261,8 @@ void ProjectExplorerPlugin::testGnuMakeParserParsing_data()
<< (QList<Task>()
<< Task(Task::Error,
QString::fromLatin1("No rule to make target `hello.c', needed by `hello.o'. Stop."),
QString(), -1,
QLatin1String(Constants::TASK_CATEGORY_BUILDSYSTEM)))
Utils::FileName(), -1,
Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM)))
<< QString()
<< QStringList();
QTest::newRow("multiple fatals")
......@@ -275,8 +275,8 @@ void ProjectExplorerPlugin::testGnuMakeParserParsing_data()
<< (QList<Task>()
<< Task(Task::Error,
QString::fromLatin1("[.obj/debug-shared/gnumakeparser.o] Error 1"),
QString(), -1,
QLatin1String(Constants::TASK_CATEGORY_BUILDSYSTEM)))
Utils::FileName(), -1,
Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM)))
<< QString()
<< QStringList();
QTest::newRow("Makefile error")
......@@ -287,8 +287,8 @@ void ProjectExplorerPlugin::testGnuMakeParserParsing_data()
<< (QList<Task>()
<< Task(Task::Error,
QString::fromLatin1("missing separator (did you mean TAB instead of 8 spaces?). Stop."),
QString::fromLatin1("Makefile"), 360,
QLatin1String(Constants::TASK_CATEGORY_BUILDSYSTEM)))
Utils::FileName::fromUserInput("Makefile"), 360,
Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM)))
<< QString()
<< QStringList();
QTest::newRow("mingw32-make error")
......@@ -300,8 +300,8 @@ void ProjectExplorerPlugin::testGnuMakeParserParsing_data()
<< (QList<Task>()
<< Task(Task::Error,
QString::fromLatin1("[debug/qplotaxis.o] Error 1"),
QString(), -1,
QLatin1String(Constants::TASK_CATEGORY_BUILDSYSTEM)))
Utils::FileName(), -1,
Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM)))
<< QString()
<< QStringList();
QTest::newRow("mingw64-make error")
......@@ -312,8 +312,8 @@ void ProjectExplorerPlugin::testGnuMakeParserParsing_data()
<< (QList<Task>()
<< Task(Task::Error,
QString::fromLatin1("[dynlib.inst] Error -1073741819"),
QString(), -1,
QLatin1String(Constants::TASK_CATEGORY_BUILDSYSTEM)))
Utils::FileName(), -1,
Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM)))
<< QString()
<< QStringList();
QTest::newRow("pass-trough note")
......@@ -332,8 +332,8 @@ void ProjectExplorerPlugin::testGnuMakeParserParsing_data()
<< (QList<Task>()
<< Task(Task::Error,
QString::fromLatin1("[sis] Error 2"),
QString(), -1,
QLatin1String(Constants::TASK_CATEGORY_BUILDSYSTEM)))
Utils::FileName(), -1,
Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM)))
<< QString()
<< QStringList();
QTest::newRow("missing g++")
......@@ -344,8 +344,8 @@ void ProjectExplorerPlugin::testGnuMakeParserParsing_data()
<< (QList<Task>()
<< Task(Task::Error,
QString::fromLatin1("g++: Command not found"),
QString(), -1,
QLatin1String(Constants::TASK_CATEGORY_BUILDSYSTEM)))
Utils::FileName(), -1,
Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM)))
<< QString()
<< QStringList();
}
......@@ -407,40 +407,40 @@ void ProjectExplorerPlugin::testGnuMakeParserTaskMangling_data()
<< QStringList()
<< Task(Task::Error,
QLatin1String("no filename, no mangling"),
QString(),
Utils::FileName(),
-1,
QLatin1String(Constants::TASK_CATEGORY_COMPILE))
Core::Id(Constants::TASK_CATEGORY_COMPILE))
<< Task(Task::Error,
QLatin1String("no filename, no mangling"),
QString(),
Utils::FileName(),
-1,
QLatin1String(Constants::TASK_CATEGORY_COMPILE));
Core::Id(Constants::TASK_CATEGORY_COMPILE));
QTest::newRow("no mangling")
<< QStringList()
<< QStringList()
<< Task(Task::Error,
QLatin1String("unknown filename, no mangling"),
QString::fromLatin1("some/path/unknown.cpp"),
Utils::FileName::fromUserInput("some/path/unknown.cpp"),
-1,
QLatin1String(Constants::TASK_CATEGORY_COMPILE))
Core::Id(Constants::TASK_CATEGORY_COMPILE))
<< Task(Task::Error,
QLatin1String("unknown filename, no mangling"),
QString::fromLatin1("some/path/unknown.cpp"),
Utils::FileName::fromUserInput("some/path/unknown.cpp"),
-1,
QLatin1String(Constants::TASK_CATEGORY_COMPILE));
Core::Id(Constants::TASK_CATEGORY_COMPILE));
QTest::newRow("find file")
<< (QStringList(QLatin1String("test/file.cpp")))
<< (QStringList(QLatin1String("test")))
<< Task(Task::Error,
QLatin1String("mangling"),
QString::fromLatin1("file.cpp"),
Utils::FileName::fromUserInput("file.cpp"),
10,
QLatin1String(Constants::TASK_CATEGORY_COMPILE))
Core::Id(Constants::TASK_CATEGORY_COMPILE))
<< Task(Task::Error,
QLatin1String("mangling"),
QString::fromLatin1("$TMPDIR/test/file.cpp"),
Utils::FileName::fromUserInput("$TMPDIR/test/file.cpp"),
10,
QLatin1String(Constants::TASK_CATEGORY_COMPILE));
Core::Id(Constants::TASK_CATEGORY_COMPILE));
}
void ProjectExplorerPlugin::testGnuMakeParserTaskMangling()
......@@ -483,8 +483,9 @@ void ProjectExplorerPlugin::testGnuMakeParserTaskMangling()
}
// fix up output task file:
if (outputTask.file.startsWith(QLatin1String("$TMPDIR/")))
outputTask.file = outputTask.file.replace(QLatin1String("$TMPDIR/"), tempdir);
QString filePath = outputTask.file.toString();
if (filePath.startsWith(QLatin1String("$TMPDIR/")))
outputTask.file = Utils::FileName::fromString(filePath.replace(QLatin1String("$TMPDIR/"), tempdir));
// test mangling:
testbench.testTaskMangling(inputTask, outputTask);
......
......@@ -70,17 +70,17 @@ void LdParser::stdError(const QString &line)
if (lne.startsWith(QLatin1String("collect2:"))) {
emit addTask(Task(Task::Error,
lne /* description */,
QString() /* filename */,
Utils::FileName() /* filename */,
-1 /* linenumber */,
QLatin1String(Constants::TASK_CATEGORY_COMPILE)));
Core::Id(Constants::TASK_CATEGORY_COMPILE)));
return;
} else if (m_regExpGccNames.indexIn(lne) > -1) {
QString description = lne.mid(m_regExpGccNames.matchedLength());
Task task(Task::Error,
description,
QString(), /* filename */
Utils::FileName(), /* filename */
-1, /* line */
QLatin1String(Constants::TASK_CATEGORY_COMPILE));
Core::Id(Constants::TASK_CATEGORY_COMPILE));
if (description.startsWith(QLatin1String("warning: "))) {
task.type = Task::Warning;
task.description = description.mid(9);
......@@ -94,13 +94,13 @@ void LdParser::stdError(const QString &line)
int lineno = m_regExpLinker.cap(7).toInt(&ok);
if (!ok)
lineno = -1;
QString filename = m_regExpLinker.cap(1);
Utils::FileName filename = Utils::FileName::fromUserInput(m_regExpLinker.cap(1));
if (!m_regExpLinker.cap(4).isEmpty()
&& !m_regExpLinker.cap(4).startsWith(QLatin1String("(.text")))
filename = m_regExpLinker.cap(4);
filename = Utils::FileName::fromUserInput(m_regExpLinker.cap(4));
QString description = m_regExpLinker.cap(8).trimmed();
Task task(Task::Error, description, filename, lineno,
QLatin1String(Constants::TASK_CATEGORY_COMPILE));
Core::Id(Constants::TASK_CATEGORY_COMPILE));
if (description.startsWith(QLatin1String("At global scope")) ||
description.startsWith(QLatin1String("At top level")) ||
description.startsWith(QLatin1String("instantiated from ")) ||
......
......@@ -73,9 +73,9 @@ void LinuxIccParser::stdError(const QString &line)
if (m_expectFirstLine && m_firstLine.indexIn(line) != -1) {
// Clear out old task
m_temporary = ProjectExplorer::Task(Task::Unknown, m_firstLine.cap(6).trimmed(),
m_firstLine.cap(1),
Utils::FileName::fromUserInput(m_firstLine.cap(1)),
m_firstLine.cap(2).toInt(),
QLatin1String(Constants::TASK_CATEGORY_COMPILE));
Core::Id(Constants::TASK_CATEGORY_COMPILE));
QString category = m_firstLine.cap(4);
if (category == QLatin1String("error"))
m_temporary.type = Task::Error;
......@@ -126,8 +126,6 @@ void ProjectExplorerPlugin::testLinuxIccOutputParsers_data()
QTest::addColumn<QList<ProjectExplorer::Task> >("tasks");
QTest::addColumn<QString>("outputLines");
const QString categoryCompile = QLatin1String(Constants::TASK_CATEGORY_COMPILE);
QTest::newRow("pass-through stdout")
<< QString::fromLatin1("Sometext") << OutputParserTester::STDOUT
<< QString::fromLatin1("Sometext\n") << QString()
......@@ -149,8 +147,8 @@ void ProjectExplorerPlugin::testLinuxIccOutputParsers_data()
<< (QList<ProjectExplorer::Task>()
<< Task(Task::Error,
QLatin1String("identifier \"f\" is undefined\nf(0);"),
QLatin1String("main.cpp"), 13,
categoryCompile))
Utils::FileName::fromUserInput("main.cpp"), 13,
Core::Id(Constants::TASK_CATEGORY_COMPILE)))
<< QString();
QTest::newRow("private function")
......@@ -163,8 +161,8 @@ void ProjectExplorerPlugin::testLinuxIccOutputParsers_data()
<< (QList<ProjectExplorer::Task>()
<< Task(Task::Error,
QLatin1String("function \"AClass::privatefunc\" (declared at line 4 of \"main.h\") is inaccessible\nb.privatefunc();"),
QLatin1String("main.cpp"), 53,
categoryCompile))
Utils::FileName::fromUserInput("main.cpp"), 53,
Core::Id(Constants::TASK_CATEGORY_COMPILE)))
<< QString();
QTest::newRow("simple warning")
......@@ -177,8 +175,8 @@ void ProjectExplorerPlugin::testLinuxIccOutputParsers_data()
<< (QList<ProjectExplorer::Task>()
<< Task(Task::Warning,
QLatin1String("use of \"=\" where \"==\" may have been intended\nwhile (a = true)"),
QLatin1String("main.cpp"), 41,
categoryCompile))
Utils::FileName::fromUserInput("main.cpp"), 41,
Core::Id(Constants::TASK_CATEGORY_COMPILE)))
<< QString();
}
......
......@@ -36,12 +36,12 @@
static const char FILE_POS_PATTERN[] = "(cl|LINK|.+) : ";
static const char ERROR_PATTERN[] = "[A-Z]+\\d\\d\\d\\d ?:";
static QPair<QString, int> parseFileName(const QString &input)
static QPair<Utils::FileName, int> parseFileName(const QString &input)
{
QString fileName = input;
if (fileName.startsWith(QLatin1String("LINK"))
|| fileName.startsWith(QLatin1String("cl")))
return qMakePair(QString(), -1);
return qMakePair(Utils::FileName(), -1);
// Extract linenumber (if it is there):
int linenumber = -1;
......@@ -56,7 +56,7 @@ static QPair<QString, int> parseFileName(const QString &input)
}
}
}