forked from qt-creator/qt-creator
Clang: Fix some issues with running indexer over Qt Creator
- fix qDebug channels on Windows - fix the number of perameters in the sql statement - fix nullptr access - speed up preprocessor a little bit Change-Id: Ic9b32fbcc6b409c4064c4f522b94391cbff8654e Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
@@ -39,6 +39,7 @@
|
||||
#include <sqliteexception.h>
|
||||
|
||||
#include <chrono>
|
||||
#include <iostream>
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
@@ -97,8 +98,20 @@ struct Data // because we have a cycle dependency
|
||||
SymbolIndexing symbolIndexing{database, filePathCache, generatedFiles, [&] (int progress, int total) { clangCodeModelServer.setProgress(progress, total); }};
|
||||
};
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
static void messageOutput(QtMsgType type, const QMessageLogContext &, const QString &msg)
|
||||
{
|
||||
std::wcout << msg.toStdWString() << std::endl;
|
||||
if (type == QtFatalMsg)
|
||||
abort();
|
||||
}
|
||||
#endif
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
qInstallMessageHandler(messageOutput);
|
||||
#endif
|
||||
try {
|
||||
QCoreApplication::setOrganizationName(QStringLiteral("QtProject"));
|
||||
QCoreApplication::setOrganizationDomain(QStringLiteral("qt-project.org"));
|
||||
|
||||
@@ -95,8 +95,6 @@ public:
|
||||
|
||||
bool isClean() const;
|
||||
|
||||
|
||||
|
||||
private:
|
||||
RefactoringCompilationDatabase m_compilationDatabase;
|
||||
std::vector<FileContent> m_fileContents;
|
||||
|
||||
@@ -341,12 +341,14 @@ public:
|
||||
m_database};
|
||||
mutable ReadStatement m_getProjectPartArtefactsBySourceId{
|
||||
"SELECT toolChainArguments, compilerMacros, systemIncludeSearchPaths, "
|
||||
"projectIncludeSearchPaths, projectPartId FROM projectParts WHERE projectPartId = (SELECT "
|
||||
"projectIncludeSearchPaths, projectPartId, language, languageVersion, languageExtension "
|
||||
"FROM projectParts WHERE projectPartId = (SELECT "
|
||||
"projectPartId FROM projectPartsSources WHERE sourceId = ?)",
|
||||
m_database};
|
||||
mutable ReadStatement m_getProjectPartArtefactsByProjectPartName{
|
||||
"SELECT toolChainArguments, compilerMacros, systemIncludeSearchPaths, "
|
||||
"projectIncludeSearchPaths, projectPartId FROM projectParts WHERE projectPartName = ?",
|
||||
"projectIncludeSearchPaths, projectPartId, language, languageVersion, languageExtension "
|
||||
"FROM projectParts WHERE projectPartName = ?",
|
||||
m_database};
|
||||
mutable ReadStatement m_getPrecompiledHeader{
|
||||
"SELECT projectPchPath, projectPchBuildTime FROM precompiledHeaders WHERE projectPartId = ?",
|
||||
|
||||
@@ -68,7 +68,8 @@ public:
|
||||
bool isAlreadyParsed(clang::FileID fileId)
|
||||
{
|
||||
const clang::FileEntry *fileEntry = m_sourceManager->getFileEntryForID(fileId);
|
||||
|
||||
if (!fileEntry)
|
||||
return false;
|
||||
return m_sourcesManager.alreadyParsed(filePathId(fileEntry),
|
||||
fileEntry->getModificationTime());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user