forked from qt-creator/qt-creator
Clang: Add diagnostics
Diagnostics are now moved to the clang backend process. Fixits are supported too. Change-Id: I20faacf466bbf78dec479220c3d7b336a47bc453 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
@@ -30,6 +30,15 @@
|
||||
|
||||
#include "clangipcserver.h"
|
||||
|
||||
#include "codecompleter.h"
|
||||
#include "diagnosticset.h"
|
||||
#include "projectpartsdonotexistexception.h"
|
||||
#include "translationunitdoesnotexistexception.h"
|
||||
#include "translationunitfilenotexitexception.h"
|
||||
#include "translationunitisnullexception.h"
|
||||
#include "translationunitparseerrorexception.h"
|
||||
#include "translationunits.h"
|
||||
|
||||
#include <clangbackendipcdebugutils.h>
|
||||
#include <cmbcodecompletedmessage.h>
|
||||
#include <cmbcompletecodemessage.h>
|
||||
@@ -37,17 +46,11 @@
|
||||
#include <cmbregistertranslationunitsforcodecompletionmessage.h>
|
||||
#include <cmbunregisterprojectsforcodecompletionmessage.h>
|
||||
#include <cmbunregistertranslationunitsforcodecompletionmessage.h>
|
||||
#include <diagnosticschangedmessage.h>
|
||||
#include <requestdiagnosticsmessage.h>
|
||||
#include <projectpartsdonotexistmessage.h>
|
||||
#include <translationunitdoesnotexistmessage.h>
|
||||
|
||||
#include "codecompleter.h"
|
||||
#include "projectpartsdonotexistexception.h"
|
||||
#include "translationunitdoesnotexistexception.h"
|
||||
#include "translationunitfilenotexitexception.h"
|
||||
#include "translationunitisnullexception.h"
|
||||
#include "translationunitparseerrorexception.h"
|
||||
#include "translationunits.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QDebug>
|
||||
|
||||
@@ -135,4 +138,24 @@ void ClangIpcServer::completeCode(const ClangBackEnd::CompleteCodeMessage &messa
|
||||
}
|
||||
}
|
||||
|
||||
void ClangIpcServer::requestDiagnostics(const RequestDiagnosticsMessage &message)
|
||||
{
|
||||
TIME_SCOPE_DURATION("ClangIpcServer::requestDiagnostics");
|
||||
|
||||
try {
|
||||
auto translationUnit = translationUnits.translationUnit(message.file().filePath(),
|
||||
message.file().projectPartId());
|
||||
|
||||
client()->diagnosticsChanged(DiagnosticsChangedMessage(translationUnit.fileContainer(),
|
||||
translationUnit.diagnostics().toDiagnosticContainers(),
|
||||
message.documentRevision()));
|
||||
} catch (const TranslationUnitDoesNotExistException &exception) {
|
||||
client()->translationUnitDoesNotExist(TranslationUnitDoesNotExistMessage(exception.fileContainer()));
|
||||
} catch (const ProjectPartDoNotExistException &exception) {
|
||||
client()->projectPartsDoNotExist(ProjectPartsDoNotExistMessage(exception.projectPartIds()));
|
||||
} catch (const std::exception &exception) {
|
||||
qWarning() << "Error in ClangIpcServer::requestDiagnostics:" << exception.what();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user