forked from qt-creator/qt-creator
ProjectExplorer: Restrain the LdParser
We cannot blindly catch any string with two colons in it. Use a whitelist instead. We can easily extend it when needed. Fixes: QTCREATORBUG-25677 Change-Id: I72f63860584af51220d6c4b71c07d2355f6bb57c Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -26,6 +26,7 @@
|
|||||||
#include "ldparser.h"
|
#include "ldparser.h"
|
||||||
#include "projectexplorerconstants.h"
|
#include "projectexplorerconstants.h"
|
||||||
|
|
||||||
|
#include <utils/algorithm.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
@@ -140,11 +141,22 @@ Utils::OutputLineParser::Result LdParser::handleLine(const QString &line, Utils:
|
|||||||
type = Task::Warning;
|
type = Task::Warning;
|
||||||
description = description.mid(9);
|
description = description.mid(9);
|
||||||
}
|
}
|
||||||
|
static const QStringList keywords{
|
||||||
|
"File format not recognized",
|
||||||
|
"undefined reference",
|
||||||
|
"first defined here",
|
||||||
|
"feupdateenv is not implemented and will always fail", // yes, this is quite special ...
|
||||||
|
};
|
||||||
|
const auto descriptionContainsKeyword = [&description](const QString &keyword) {
|
||||||
|
return description.contains(keyword);
|
||||||
|
};
|
||||||
|
if (Utils::anyOf(keywords, descriptionContainsKeyword)) {
|
||||||
LinkSpecs linkSpecs;
|
LinkSpecs linkSpecs;
|
||||||
addLinkSpecForAbsoluteFilePath(linkSpecs, filename, lineno, match, capIndex);
|
addLinkSpecForAbsoluteFilePath(linkSpecs, filename, lineno, match, capIndex);
|
||||||
scheduleTask(CompileTask(type, description, filename, lineno), 1);
|
scheduleTask(CompileTask(type, description, filename, lineno), 1);
|
||||||
return {Status::Done, linkSpecs};
|
return {Status::Done, linkSpecs};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return Status::NotHandled;
|
return Status::NotHandled;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user