forked from qt-creator/qt-creator
		
	CppTools: Add diagnostic message for non-existent absolute paths
Change-Id: I9a05a92c1adc37db0c918127715714d1f6d2a78d Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
		@@ -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);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user