forked from qt-creator/qt-creator
ProjectExplorer: Point the user to the right source location
... when parsing gcc error messages with a "required from here" part. It's typically buried deep within the output, but points to the actual problem. Change-Id: I06d778655d9e21edb7148f37f3921764e30353ee Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -117,12 +117,22 @@ void GccParser::createOrAmendTask(
|
|||||||
|| (m_currentTask.type == Task::Unknown && type != Task::Unknown)) {
|
|| (m_currentTask.type == Task::Unknown && type != Task::Unknown)) {
|
||||||
m_currentTask.type = type;
|
m_currentTask.type = type;
|
||||||
m_currentTask.summary = description;
|
m_currentTask.summary = description;
|
||||||
if (!file.isEmpty()) {
|
if (!file.isEmpty() && !m_requiredFromHereFound) {
|
||||||
m_currentTask.setFile(file);
|
m_currentTask.setFile(file);
|
||||||
m_currentTask.line = line;
|
m_currentTask.line = line;
|
||||||
m_currentTask.column = column;
|
m_currentTask.column = column;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If a "required from here" line is present, it is almost always the cause of the problem,
|
||||||
|
// so that's where we should go when the issue is double-clicked.
|
||||||
|
if (originalLine.endsWith("required from here") && !file.isEmpty() && line > 0) {
|
||||||
|
m_requiredFromHereFound = true;
|
||||||
|
m_currentTask.setFile(file);
|
||||||
|
m_currentTask.line = line;
|
||||||
|
m_currentTask.column = column;
|
||||||
|
}
|
||||||
|
|
||||||
++m_lines;
|
++m_lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,6 +152,7 @@ void GccParser::flush()
|
|||||||
m_linkSpecs.clear();
|
m_linkSpecs.clear();
|
||||||
scheduleTask(t, m_lines, 1);
|
scheduleTask(t, m_lines, 1);
|
||||||
m_lines = 0;
|
m_lines = 0;
|
||||||
|
m_requiredFromHereFound = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
OutputLineParser::Result GccParser::handleLine(const QString &line, OutputFormat type)
|
OutputLineParser::Result GccParser::handleLine(const QString &line, OutputFormat type)
|
||||||
@@ -1346,8 +1357,8 @@ void ProjectExplorerPlugin::testGccOutputParsers_data()
|
|||||||
"qmap.h:110:7: error: ‘QMapNode<Key, T>::value’ has incomplete type\n"
|
"qmap.h:110:7: error: ‘QMapNode<Key, T>::value’ has incomplete type\n"
|
||||||
" 110 | T value;\n"
|
" 110 | T value;\n"
|
||||||
" | ^~~~~",
|
" | ^~~~~",
|
||||||
FilePath::fromUserInput("qmap.h"),
|
FilePath::fromUserInput("moc_helpindexfilter.cpp"),
|
||||||
110, 7,
|
105, 1,
|
||||||
QVector<QTextLayout::FormatRange>()
|
QVector<QTextLayout::FormatRange>()
|
||||||
<< formatRange(46, 1458))}
|
<< formatRange(46, 1458))}
|
||||||
<< QString();
|
<< QString();
|
||||||
|
@@ -72,6 +72,7 @@ private:
|
|||||||
Task m_currentTask;
|
Task m_currentTask;
|
||||||
LinkSpecs m_linkSpecs;
|
LinkSpecs m_linkSpecs;
|
||||||
int m_lines = 0;
|
int m_lines = 0;
|
||||||
|
bool m_requiredFromHereFound = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ProjectExplorer
|
} // namespace ProjectExplorer
|
||||||
|
Reference in New Issue
Block a user