Commit 4bf11c7d authored by Nikolai Kosjar's avatar Nikolai Kosjar

CppTools: Add diagnostic message for non-existent absolute paths

Change-Id: I9a05a92c1adc37db0c918127715714d1f6d2a78d
Reviewed-by: default avatarErik Verbruggen <erik.verbruggen@digia.com>
parent aa796a9f
......@@ -235,10 +235,12 @@ QString CppPreprocessor::cleanPath(const QString &path)
QString CppPreprocessor::resolveFile_helper(const QString &fileName, IncludeType type)
{
const QFileInfo fileInfo(fileName);
if (isInjectedFile(fileName) || fileInfo.isAbsolute())
if (isInjectedFile(fileName))
return fileName;
if (QFileInfo(fileName).isAbsolute())
return checkFile(fileName) ? fileName : QString();
if (type == IncludeLocal && m_currentDoc) {
const QFileInfo currentFileInfo(m_currentDoc->fileName());
const QString path = cleanPath(currentFileInfo.absolutePath()) + fileName;
......
......@@ -168,6 +168,7 @@ void CppToolsPlugin::test_cpppreprocessor_includes_allDiagnostics()
QByteArray source =
"#include <NotResolvable1>\n"
"#include <NotResolvable2>\n"
"#include \"/some/nonexisting/file123.h\"\n"
"\n"
;
......@@ -176,6 +177,6 @@ void CppToolsPlugin::test_cpppreprocessor_includes_allDiagnostics()
QVERIFY(document);
QCOMPARE(document->resolvedIncludes().size(), 0);
QCOMPARE(document->unresolvedIncludes().size(), 2);
QCOMPARE(document->diagnosticMessages().size(), 2);
QCOMPARE(document->unresolvedIncludes().size(), 3);
QCOMPARE(document->diagnosticMessages().size(), 3);
}
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