data: record Clang Invocation errors as errors when nothing is recorded
This commit is contained in:
@@ -32,6 +32,8 @@ public:
|
||||
virtual void recordComment(const ParseLocation& location) = 0;
|
||||
|
||||
virtual void recordError(const std::wstring& message, bool fatal, bool indexed, const FilePath& translationUnit, const ParseLocation& location) = 0;
|
||||
|
||||
virtual bool hasContent() const = 0;
|
||||
};
|
||||
|
||||
#endif // PARSER_CLIENT_H
|
||||
|
||||
@@ -99,6 +99,11 @@ void ParserClientImpl::recordError(
|
||||
}
|
||||
}
|
||||
|
||||
bool ParserClientImpl::hasContent() const
|
||||
{
|
||||
return m_storage->getByteSize(1) > 0;
|
||||
}
|
||||
|
||||
NodeType ParserClientImpl::symbolKindToNodeType(SymbolKind symbolKind) const
|
||||
{
|
||||
switch (symbolKind)
|
||||
|
||||
@@ -31,6 +31,8 @@ public:
|
||||
|
||||
void recordError(const std::wstring& message, bool fatal, bool indexed, const FilePath& translationUnit, const ParseLocation& location) override;
|
||||
|
||||
bool hasContent() const override;
|
||||
|
||||
private:
|
||||
NodeType symbolKindToNodeType(SymbolKind symbolType) const;
|
||||
Edge::EdgeType referenceKindToEdgeType(ReferenceKind referenceKind) const;
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "FileRegister.h"
|
||||
#include "IndexerCommandCxx.h"
|
||||
#include "logging.h"
|
||||
#include "ParserClient.h"
|
||||
#include "ResourcePaths.h"
|
||||
#include "TextAccess.h"
|
||||
#include "utilityString.h"
|
||||
@@ -190,10 +191,10 @@ void CxxParser::runTool(clang::tooling::CompilationDatabase* compilationDatabase
|
||||
|
||||
tool.setDiagnosticConsumer(diagnostics.get());
|
||||
|
||||
ClangInvocationInfo info;
|
||||
if (LogManager::getInstance()->getLoggingEnabled())
|
||||
{
|
||||
const ClangInvocationInfo info = getClangInvocationString(compilationDatabase);
|
||||
|
||||
info = getClangInvocationString(compilationDatabase);
|
||||
LOG_INFO("Clang Invocation: " + info.invocation.substr(0, ApplicationSettings::getInstance()->getVerboseIndexerLoggingEnabled() ? std::string::npos : 20000));
|
||||
|
||||
if (!info.errors.empty())
|
||||
@@ -204,6 +205,26 @@ void CxxParser::runTool(clang::tooling::CompilationDatabase* compilationDatabase
|
||||
|
||||
ASTActionFactory actionFactory(m_client, canonicalFilePathCache, m_indexerStateInfo);
|
||||
tool.run(&actionFactory);
|
||||
|
||||
if (!m_client->hasContent())
|
||||
{
|
||||
if (info.invocation.empty())
|
||||
{
|
||||
info = getClangInvocationString(compilationDatabase);
|
||||
}
|
||||
|
||||
if (!info.errors.empty())
|
||||
{
|
||||
Id fileId = m_client->recordFile(sourceFilePath, true);
|
||||
m_client->recordError(
|
||||
L"Clang Invocation errors: " + utility::decodeFromUtf8(info.errors),
|
||||
true,
|
||||
true,
|
||||
sourceFilePath,
|
||||
ParseLocation(fileId, 1, 1)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::string> CxxParser::getCommandlineArgumentsEssential(const std::vector<std::wstring>& compilerFlags) const
|
||||
|
||||
Reference in New Issue
Block a user