forked from qt-creator/qt-creator
Clang: Report only diagnostics that can be shown in the editor
Change-Id: I9c258159d240c6ba7eeff34702d8512d9220b3af Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
This commit is contained in:
@@ -33,8 +33,10 @@
|
||||
#include "clangstring.h"
|
||||
#include "codecompleter.h"
|
||||
#include "commandlinearguments.h"
|
||||
#include "diagnosticcontainer.h"
|
||||
#include "diagnosticset.h"
|
||||
#include "projectpart.h"
|
||||
#include "sourcelocation.h"
|
||||
#include "translationunitfilenotexitexception.h"
|
||||
#include "translationunitisnullexception.h"
|
||||
#include "translationunitparseerrorexception.h"
|
||||
@@ -218,6 +220,16 @@ DiagnosticSet TranslationUnit::diagnostics() const
|
||||
return DiagnosticSet(clang_getDiagnosticSetFromTU(cxTranslationUnit()));
|
||||
}
|
||||
|
||||
QVector<ClangBackEnd::DiagnosticContainer> TranslationUnit::mainFileDiagnostics() const
|
||||
{
|
||||
const auto mainFilePath = filePath();
|
||||
const auto isMainFileDiagnostic = [mainFilePath](const Diagnostic &diagnostic) {
|
||||
return diagnostic.location().filePath() == mainFilePath;
|
||||
};
|
||||
|
||||
return diagnostics().toDiagnosticContainers(isMainFileDiagnostic);
|
||||
}
|
||||
|
||||
const QSet<Utf8String> &TranslationUnit::dependedFilePaths() const
|
||||
{
|
||||
createTranslationUnitIfNeeded();
|
||||
|
||||
Reference in New Issue
Block a user