diff --git a/src/lib_cxx/data/parser/cxx/CxxDiagnosticConsumer.cpp b/src/lib_cxx/data/parser/cxx/CxxDiagnosticConsumer.cpp index ab4e9b4f..7f5a08bc 100644 --- a/src/lib_cxx/data/parser/cxx/CxxDiagnosticConsumer.cpp +++ b/src/lib_cxx/data/parser/cxx/CxxDiagnosticConsumer.cpp @@ -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("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( diff --git a/src/lib_cxx/data/parser/cxx/CxxDiagnosticConsumer.h b/src/lib_cxx/data/parser/cxx/CxxDiagnosticConsumer.h index f95e8337..e4ce29f8 100644 --- a/src/lib_cxx/data/parser/cxx/CxxDiagnosticConsumer.h +++ b/src/lib_cxx/data/parser/cxx/CxxDiagnosticConsumer.h @@ -30,7 +30,6 @@ private: std::shared_ptr m_canonicalFilePathCache; const FilePath m_sourceFilePath; - bool m_isParsingFile; bool m_useLogging; };