aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/clangtools/clangtoolslogfilereader.cpp
diff options
context:
space:
mode:
authorNikolai Kosjar <[email protected]>2019-07-26 12:44:17 +0200
committerNikolai Kosjar <[email protected]>2019-08-27 08:27:09 +0000
commit0979a586893058bcca524ea45d9b5c090d77c634 (patch)
tree77ac6c73b66933c25c286cb389ee0437d46e67b0 /src/plugins/clangtools/clangtoolslogfilereader.cpp
parentc4889e9904f9716f6c1998e45a6d345aee98075c (diff)
ClangTools: Extract filtering in readSerializedDiagnostics()
Change-Id: I07a4339af72d1e232eb7fe152a6af133a6a94436 Reviewed-by: David Schulz <[email protected]>
Diffstat (limited to 'src/plugins/clangtools/clangtoolslogfilereader.cpp')
-rw-r--r--src/plugins/clangtools/clangtoolslogfilereader.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/plugins/clangtools/clangtoolslogfilereader.cpp b/src/plugins/clangtools/clangtoolslogfilereader.cpp
index 4c4dc50c27b..afca7d96179 100644
--- a/src/plugins/clangtools/clangtoolslogfilereader.cpp
+++ b/src/plugins/clangtools/clangtoolslogfilereader.cpp
@@ -122,7 +122,7 @@ static ExplainingStep buildFixIt(const CXDiagnostic cxDiagnostic, unsigned index
}
static Diagnostic buildDiagnostic(const CXDiagnostic cxDiagnostic,
- const QSet<Utils::FilePath> &projectFiles,
+ const AcceptDiagsFromFilePath &acceptFromFilePath,
const QString &nativeFilePath)
{
Diagnostic diagnostic;
@@ -136,7 +136,7 @@ static Diagnostic buildDiagnostic(const CXDiagnostic cxDiagnostic,
diagnostic.location = diagLocationFromSourceLocation(cxLocation);
const auto diagnosticFilePath = Utils::FilePath::fromString(diagnostic.location.filePath);
- if (!projectFiles.contains(diagnosticFilePath))
+ if (acceptFromFilePath && !acceptFromFilePath(diagnosticFilePath))
return diagnostic;
// TODO: Introduce CppTools::ProjectFile::isGenerated to filter these out properly
@@ -184,7 +184,7 @@ static Diagnostic buildDiagnostic(const CXDiagnostic cxDiagnostic,
static Diagnostics readSerializedDiagnostics_helper(const Utils::FilePath &logFilePath,
const Utils::FilePath &mainFilePath,
- const QSet<Utils::FilePath> &projectFiles)
+ const AcceptDiagsFromFilePath &acceptFromFilePath)
{
Diagnostics list;
CXLoadDiag_Error error;
@@ -206,7 +206,7 @@ static Diagnostics readSerializedDiagnostics_helper(const Utils::FilePath &logFi
Utils::ExecuteOnDestruction cleanUpDiagnostic([&]() {
clang_disposeDiagnostic(cxDiagnostic);
});
- const Diagnostic diagnostic = buildDiagnostic(cxDiagnostic, projectFiles, nativeFilePath);
+ const Diagnostic diagnostic = buildDiagnostic(cxDiagnostic, acceptFromFilePath, nativeFilePath);
if (!diagnostic.isValid())
continue;
@@ -233,13 +233,13 @@ static bool checkFilePath(const Utils::FilePath &filePath, QString *errorMessage
Diagnostics readSerializedDiagnostics(const Utils::FilePath &logFilePath,
const Utils::FilePath &mainFilePath,
- const QSet<Utils::FilePath> &projectFiles,
+ const AcceptDiagsFromFilePath &acceptFromFilePath,
QString *errorMessage)
{
if (!checkFilePath(logFilePath, errorMessage))
return {};
- return readSerializedDiagnostics_helper(logFilePath, mainFilePath, projectFiles);
+ return readSerializedDiagnostics_helper(logFilePath, mainFilePath, acceptFromFilePath);
}
} // namespace Internal