build: merge Coati app and Trial to single executable
* removed trial target * updated deploy scripts to exclude trial * cleanup CMakeLists * removed Eigen dependencies * split parser lib into lib_cxx and lib_java * added ProjectFactory and ProjectFactoryModules * removed old installer projects * updated wix installer * updated readme for wix setup * updated to use obfuscated exe * added qt.conf * added indexing dialog images * added jars * added coatidb files of sample projects * added source code of javaparser sample * removed auto-refresh image * intermediate files of windows installer are created in build folder * preselected desktop shortcut * build bat is executed from deploy_windows script
This commit is contained in:
@@ -0,0 +1,89 @@
|
||||
#include "data/parser/cxx/CxxDiagnosticConsumer.h"
|
||||
|
||||
#include "clang/Basic/SourceManager.h"
|
||||
#include "clang/Tooling/Tooling.h"
|
||||
|
||||
#include "data/parser/ParseLocation.h"
|
||||
#include "data/parser/ParserClient.h"
|
||||
#include "utility/file/FileRegister.h"
|
||||
|
||||
CxxDiagnosticConsumer::CxxDiagnosticConsumer(
|
||||
clang::raw_ostream &os,
|
||||
clang::DiagnosticOptions *diags,
|
||||
ParserClient* client,
|
||||
FileRegister* fileRegister,
|
||||
bool useLogging
|
||||
)
|
||||
: clang::TextDiagnosticPrinter(os, diags)
|
||||
, m_client(client)
|
||||
, m_register(fileRegister)
|
||||
, m_isParsingFile(false)
|
||||
, m_useLogging(useLogging)
|
||||
{
|
||||
}
|
||||
|
||||
void CxxDiagnosticConsumer::BeginSourceFile(const clang::LangOptions& langOptions, const clang::Preprocessor* preProcessor)
|
||||
{
|
||||
if (m_useLogging)
|
||||
{
|
||||
clang::TextDiagnosticPrinter::BeginSourceFile(langOptions, preProcessor);
|
||||
}
|
||||
|
||||
m_isParsingFile = true;
|
||||
}
|
||||
|
||||
void CxxDiagnosticConsumer::EndSourceFile()
|
||||
{
|
||||
if (m_useLogging)
|
||||
{
|
||||
clang::TextDiagnosticPrinter::EndSourceFile();
|
||||
}
|
||||
|
||||
m_isParsingFile = false;
|
||||
}
|
||||
|
||||
void CxxDiagnosticConsumer::HandleDiagnostic(clang::DiagnosticsEngine::Level level, const clang::Diagnostic& info)
|
||||
{
|
||||
if (m_useLogging)
|
||||
{
|
||||
clang::TextDiagnosticPrinter::HandleDiagnostic(level, info);
|
||||
}
|
||||
|
||||
if (!m_isParsingFile)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (level >= clang::DiagnosticsEngine::Error)
|
||||
{
|
||||
llvm::SmallString<100> messageStr;
|
||||
info.FormatDiagnostic(messageStr);
|
||||
std::string message = messageStr.str();
|
||||
|
||||
if (message == "MS-style inline assembly is not available: Unable to find target for this triple (no targets are registered)")
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
std::string filePath;
|
||||
uint line = 0;
|
||||
uint column = 0;
|
||||
|
||||
if (info.getLocation().isValid() && info.hasSourceManager())
|
||||
{
|
||||
const clang::SourceManager& sourceManager = info.getSourceManager();
|
||||
clang::PresumedLoc presumedLocation = sourceManager.getPresumedLoc(info.getLocation());
|
||||
|
||||
filePath = clang::tooling::getAbsolutePath(presumedLocation.getFilename());
|
||||
line = presumedLocation.getLine();
|
||||
column = presumedLocation.getColumn();
|
||||
}
|
||||
|
||||
m_client->onError(
|
||||
ParseLocation(filePath, line, column),
|
||||
message,
|
||||
level == clang::DiagnosticsEngine::Fatal,
|
||||
m_register->hasFilePath(filePath)
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user