ClangTools: Show also diagnostics from project's header files

Fixes: QTCREATORBUG-21452
Change-Id: I73c85224e142f4f1d08c9ada75fe8359ebf0f984
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
Nikolai Kosjar
2019-01-22 12:04:51 +01:00
parent 171f3aec26
commit 46fc8c4144
11 changed files with 79 additions and 27 deletions

View File

@@ -387,13 +387,24 @@ void ClangToolRunControl::analyzeNextFile()
Utils::StdOutFormat);
}
static Utils::FileName cleanPath(const Utils::FileName &filePath)
{
return Utils::FileName::fromString(QDir::cleanPath(filePath.toString()));
}
void ClangToolRunControl::onRunnerFinishedWithSuccess(const QString &filePath)
{
const QString logFilePath = qobject_cast<ClangToolRunner *>(sender())->logFilePath();
qCDebug(LOG) << "onRunnerFinishedWithSuccess:" << logFilePath;
QTC_ASSERT(m_projectInfo.project(), return);
const Utils::FileName projectRootDir = cleanPath(m_projectInfo.project()->projectDirectory());
QString errorMessage;
const QList<Diagnostic> diagnostics = tool()->read(filePath, logFilePath, &errorMessage);
const QList<Diagnostic> diagnostics = tool()->read(filePath,
projectRootDir,
logFilePath,
&errorMessage);
QFile::remove(logFilePath); // Clean-up.
if (!errorMessage.isEmpty()) {