forked from qt-creator/qt-creator
Don't attempt to analyze using icecc masquerading as clang.
Also warn the user in the settings page against this. Change-Id: I4dbae953aa85f8dbdc9baa8dd0fda8ff0da45b76 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
|
||||
#include <utils/environment.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QFileInfo>
|
||||
|
||||
static bool isFileExecutable(const QString &executablePath)
|
||||
@@ -63,7 +64,7 @@ QString clangExecutable(const QString &fileNameOrPath, bool *isValid)
|
||||
executable = executableFromPath;
|
||||
}
|
||||
|
||||
*isValid = isFileExecutable(executable);
|
||||
*isValid = isFileExecutable(executable) && isClangExecutableUsable(executable);
|
||||
return executable;
|
||||
}
|
||||
|
||||
@@ -74,5 +75,20 @@ QString createFullLocationString(const ClangStaticAnalyzer::Internal::Location &
|
||||
return filePath + QLatin1Char(':') + lineNumber;
|
||||
}
|
||||
|
||||
bool isClangExecutableUsable(const QString &filePath, QString *errorMessage)
|
||||
{
|
||||
const QFileInfo fi(filePath);
|
||||
if (fi.isSymLink() && fi.symLinkTarget().contains(QLatin1String("icecc"))) {
|
||||
if (errorMessage) {
|
||||
*errorMessage = QCoreApplication::translate("ClangStaticAnalyzer",
|
||||
"The chosen file \"%1\" seems to point to an icecc binary not suitable "
|
||||
"for analyzing.\nPlease set a real clang executable.")
|
||||
.arg(filePath);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace ClangStaticAnalyzer
|
||||
|
||||
Reference in New Issue
Block a user