logic: record and display cxx indexer configuration issues (issue #618)

This commit is contained in:
mlangkabel
2018-09-14 15:31:27 +02:00
parent eb0bf063b8
commit 5b7938eda6
2 changed files with 8 additions and 11 deletions
@@ -21,7 +21,6 @@ CxxDiagnosticConsumer::CxxDiagnosticConsumer(
, m_client(client)
, m_canonicalFilePathCache(canonicalFilePathCache)
, m_sourceFilePath(sourceFilePath)
, m_isParsingFile(false)
, m_useLogging(useLogging)
{
}
@@ -32,8 +31,6 @@ void CxxDiagnosticConsumer::BeginSourceFile(const clang::LangOptions& langOption
{
clang::TextDiagnosticPrinter::BeginSourceFile(langOptions, preProcessor);
}
m_isParsingFile = true;
}
void CxxDiagnosticConsumer::EndSourceFile()
@@ -42,8 +39,6 @@ void CxxDiagnosticConsumer::EndSourceFile()
{
clang::TextDiagnosticPrinter::EndSourceFile();
}
m_isParsingFile = false;
}
void CxxDiagnosticConsumer::HandleDiagnostic(clang::DiagnosticsEngine::Level level, const clang::Diagnostic& info)
@@ -53,11 +48,6 @@ void CxxDiagnosticConsumer::HandleDiagnostic(clang::DiagnosticsEngine::Level lev
clang::TextDiagnosticPrinter::HandleDiagnostic(level, info);
}
if (!m_isParsingFile)
{
return;
}
if (level >= clang::DiagnosticsEngine::Error)
{
llvm::SmallString<100> messageStr;
@@ -68,6 +58,10 @@ void CxxDiagnosticConsumer::HandleDiagnostic(clang::DiagnosticsEngine::Level lev
{
return;
}
if (utility::isPrefix<std::string>("unknown argument:", message))
{
return;
}
ParseLocation location(FilePath(), 0, 0);
if (info.getLocation().isValid() && info.hasSourceManager())
@@ -96,6 +90,10 @@ void CxxDiagnosticConsumer::HandleDiagnostic(clang::DiagnosticsEngine::Level lev
}
}
}
else
{
location = ParseLocation(m_canonicalFilePathCache->getCanonicalFilePath(m_sourceFilePath.wstr()), 1, 1);
}
if (location.isValid())
{
m_client->recordError(
@@ -30,7 +30,6 @@ private:
std::shared_ptr<CanonicalFilePathCache> m_canonicalFilePathCache;
const FilePath m_sourceFilePath;
bool m_isParsingFile;
bool m_useLogging;
};