ui: store and display translation unit of recorded indexing errors

This commit is contained in:
mlangkabel
2018-07-02 13:00:41 +02:00
parent 6794b61fab
commit 7c09f3339b
17 changed files with 77 additions and 49 deletions
+1 -1
View File
@@ -144,7 +144,7 @@ void TaskBuildIndex::doExit(std::shared_ptr<Blackboard> blackboard)
is->addError(StorageErrorData( is->addError(StorageErrorData(
L"The translation unit threw an exception during indexing. Please check if the source file " L"The translation unit threw an exception during indexing. Please check if the source file "
"conforms to the specified language standard and all necessary options are defined within your project " "conforms to the specified language standard and all necessary options are defined within your project "
"setup.", path.wstr(), 1, 1, true, true "setup.", path.wstr(), 1, 1, path.wstr(), true, true
)); ));
LOG_INFO(L"crashed translation unit: " + path.wstr()); LOG_INFO(L"crashed translation unit: " + path.wstr());
} }
@@ -123,6 +123,7 @@ struct SharedStorageErrorData
const std::string& filePath, const std::string& filePath,
uint lineNumber, uint lineNumber,
uint columnNumber, uint columnNumber,
const std::string& sourceFilePath,
bool fatal, bool fatal,
bool indexed, bool indexed,
SharedMemory::Allocator* allocator SharedMemory::Allocator* allocator
@@ -131,6 +132,7 @@ struct SharedStorageErrorData
, filePath(filePath.c_str(), allocator) , filePath(filePath.c_str(), allocator)
, lineNumber(lineNumber) , lineNumber(lineNumber)
, columnNumber(columnNumber) , columnNumber(columnNumber)
, translationUnit(sourceFilePath.c_str(), allocator)
, fatal(fatal) , fatal(fatal)
, indexed(indexed) , indexed(indexed)
{} {}
@@ -141,6 +143,7 @@ struct SharedStorageErrorData
uint lineNumber; uint lineNumber;
uint columnNumber; uint columnNumber;
SharedMemory::String translationUnit;
bool fatal; bool fatal;
bool indexed; bool indexed;
}; };
@@ -152,6 +155,7 @@ inline SharedStorageErrorData toShared(const StorageErrorData& error, SharedMemo
utility::encodeToUtf8(error.filePath), utility::encodeToUtf8(error.filePath),
error.lineNumber, error.lineNumber,
error.columnNumber, error.columnNumber,
utility::encodeToUtf8(error.translationUnit),
error.fatal, error.fatal,
error.indexed, allocator error.indexed, allocator
); );
@@ -164,6 +168,7 @@ inline StorageErrorData fromShared(const SharedStorageErrorData& error)
utility::decodeFromUtf8(error.filePath.c_str()), utility::decodeFromUtf8(error.filePath.c_str()),
error.lineNumber, error.lineNumber,
error.columnNumber, error.columnNumber,
utility::decodeFromUtf8(error.translationUnit.c_str()),
error.fatal, error.fatal,
error.indexed error.indexed
); );
+2 -6
View File
@@ -75,14 +75,10 @@ ParserClient::ParserClient()
{ {
} }
ParserClient::~ParserClient()
{
}
void ParserClient::recordError( void ParserClient::recordError(
const ParseLocation& location, const std::wstring& message, bool fatal, bool indexed) const ParseLocation& errorLocation, const std::wstring& message, bool fatal, bool indexed, const FilePath& translationUnit)
{ {
doRecordError(location, message, fatal, indexed); doRecordError(errorLocation, message, fatal, indexed, translationUnit);
if (fatal) if (fatal)
{ {
+3 -3
View File
@@ -26,7 +26,7 @@ public:
const std::wstring& str, const ParseLocation& location, const ParseLocation& scopeLocation); const std::wstring& str, const ParseLocation& location, const ParseLocation& scopeLocation);
ParserClient(); ParserClient();
virtual ~ParserClient(); virtual ~ParserClient() = default;
virtual Id recordSymbol( virtual Id recordSymbol(
const NameHierarchy& symbolName, SymbolKind symbolKind, const NameHierarchy& symbolName, SymbolKind symbolKind,
@@ -50,7 +50,7 @@ public:
const NameHierarchy& qualifierName, const ParseLocation& location) = 0; const NameHierarchy& qualifierName, const ParseLocation& location) = 0;
void recordError( void recordError(
const ParseLocation& location, const std::wstring& message, bool fatal, bool indexed); const ParseLocation& errorLocation, const std::wstring& message, bool fatal, bool indexed, const FilePath& translationUnit);
virtual void recordLocalSymbol(const std::wstring& name, const ParseLocation& location) = 0; virtual void recordLocalSymbol(const std::wstring& name, const ParseLocation& location) = 0;
virtual void recordFile(const FileInfo& fileInfo, bool indexed) = 0; virtual void recordFile(const FileInfo& fileInfo, bool indexed) = 0;
@@ -60,7 +60,7 @@ public:
protected: protected:
virtual void doRecordError( virtual void doRecordError(
const ParseLocation& location, const std::wstring& message, bool fatal, bool indexed) = 0; const ParseLocation& errorLocation, const std::wstring& message, bool fatal, bool indexed, const FilePath& translationUnit) = 0;
bool m_hasFatalErrors; bool m_hasFatalErrors;
}; };
+4 -4
View File
@@ -91,11 +91,11 @@ void ParserClientImpl::recordComment(const ParseLocation& location)
} }
void ParserClientImpl::doRecordError( void ParserClientImpl::doRecordError(
const ParseLocation& location, const std::wstring& message, bool fatal, bool indexed) const ParseLocation& location, const std::wstring& message, bool fatal, bool indexed, const FilePath& translationUnit)
{ {
if (location.isValid()) if (location.isValid())
{ {
addError(message, fatal, indexed, location); addError(message, fatal, indexed, location, translationUnit);
} }
} }
@@ -331,7 +331,7 @@ void ParserClientImpl::addCommentLocation(const ParseLocation& location)
} }
void ParserClientImpl::addError( void ParserClientImpl::addError(
const std::wstring& message, bool fatal, bool indexed, const ParseLocation& location) const std::wstring& message, bool fatal, bool indexed, const ParseLocation& location, const FilePath& translationUnit)
{ {
if (!m_storage) if (!m_storage)
{ {
@@ -339,6 +339,6 @@ void ParserClientImpl::addError(
} }
m_storage->addError(StorageErrorData( m_storage->addError(StorageErrorData(
message, location.filePath.wstr(), location.startLineNumber, location.startColumnNumber, fatal, indexed message, location.filePath.wstr(), location.startLineNumber, location.startColumnNumber, translationUnit.wstr(), fatal, indexed
)); ));
} }
+2 -2
View File
@@ -45,7 +45,7 @@ public:
private: private:
virtual void doRecordError( virtual void doRecordError(
const ParseLocation& location, const std::wstring& message, bool fatal, bool indexed) override; const ParseLocation& location, const std::wstring& message, bool fatal, bool indexed, const FilePath& sourceFilePath) override;
NodeType symbolKindToNodeType(SymbolKind symbolType) const; NodeType symbolKindToNodeType(SymbolKind symbolType) const;
Edge::EdgeType referenceKindToEdgeType(ReferenceKind referenceKind) const; Edge::EdgeType referenceKindToEdgeType(ReferenceKind referenceKind) const;
@@ -61,7 +61,7 @@ private:
void addComponentAccess(Id nodeId , int type); void addComponentAccess(Id nodeId , int type);
void addCommentLocation(const ParseLocation& location); void addCommentLocation(const ParseLocation& location);
void addError(const std::wstring& message, bool fatal, bool indexed, void addError(const std::wstring& message, bool fatal, bool indexed,
const ParseLocation& location); const ParseLocation& location, const FilePath& sourceFilePath);
std::shared_ptr<IntermediateStorage> m_storage; std::shared_ptr<IntermediateStorage> m_storage;
}; };
@@ -9,7 +9,7 @@
#include "data/location/SourceLocationCollection.h" #include "data/location/SourceLocationCollection.h"
#include "data/location/SourceLocationFile.h" #include "data/location/SourceLocationFile.h"
const size_t SqliteIndexStorage::s_storageVersion = 16; const size_t SqliteIndexStorage::s_storageVersion = 17;
SqliteIndexStorage::SqliteIndexStorage(const FilePath& dbFilePath) SqliteIndexStorage::SqliteIndexStorage(const FilePath& dbFilePath)
: SqliteStorage(dbFilePath.getCanonical()) : SqliteStorage(dbFilePath.getCanonical())
@@ -281,6 +281,7 @@ StorageError SqliteIndexStorage::addError(const StorageErrorData& data)
m_insertErrorStmt.bind(4, utility::encodeToUtf8(data.filePath).c_str()); m_insertErrorStmt.bind(4, utility::encodeToUtf8(data.filePath).c_str());
m_insertErrorStmt.bind(5, int(data.lineNumber)); m_insertErrorStmt.bind(5, int(data.lineNumber));
m_insertErrorStmt.bind(6, int(data.columnNumber)); m_insertErrorStmt.bind(6, int(data.columnNumber));
m_insertErrorStmt.bind(7, utility::encodeToUtf8(data.translationUnit).c_str());
const bool success = executeStatement(m_insertErrorStmt); const bool success = executeStatement(m_insertErrorStmt);
if (success) if (success)
@@ -1056,6 +1057,7 @@ void SqliteIndexStorage::setupTables()
"file_path TEXT, " "file_path TEXT, "
"line_number INTEGER, " "line_number INTEGER, "
"column_number INTEGER, " "column_number INTEGER, "
"translation_unit TEXT, "
"PRIMARY KEY(id));" "PRIMARY KEY(id));"
); );
} }
@@ -1136,7 +1138,7 @@ void SqliteIndexStorage::setupPrecompiledStatements()
"LIMIT 1;" "LIMIT 1;"
); );
m_insertErrorStmt = m_database.compileStatement( m_insertErrorStmt = m_database.compileStatement(
"INSERT INTO error(message, fatal, indexed, file_path, line_number, column_number) VALUES(?, ?, ?, ?, ?, ?);" "INSERT INTO error(message, fatal, indexed, file_path, line_number, column_number, translation_unit) VALUES(?, ?, ?, ?, ?, ?, ?);"
); );
} }
catch (CppSQLite3Exception& e) catch (CppSQLite3Exception& e)
@@ -1383,7 +1385,7 @@ template <>
std::vector<StorageError> SqliteIndexStorage::doGetAll<StorageError>(const std::string& query) const std::vector<StorageError> SqliteIndexStorage::doGetAll<StorageError>(const std::string& query) const
{ {
CppSQLite3Query q = executeQuery( CppSQLite3Query q = executeQuery(
"SELECT message, fatal, indexed, file_path, line_number, column_number FROM error " + query + ";" "SELECT message, fatal, indexed, file_path, line_number, column_number, translation_unit FROM error " + query + ";"
); );
std::vector<StorageError> errors; std::vector<StorageError> errors;
@@ -1396,11 +1398,12 @@ std::vector<StorageError> SqliteIndexStorage::doGetAll<StorageError>(const std::
const std::string filePath = q.getStringField(3, ""); const std::string filePath = q.getStringField(3, "");
const int lineNumber = q.getIntField(4, -1); const int lineNumber = q.getIntField(4, -1);
const int columnNumber = q.getIntField(5, -1); const int columnNumber = q.getIntField(5, -1);
const std::string translationUnit = q.getStringField(6, "");
if (lineNumber != -1 && columnNumber != -1) if (lineNumber != -1 && columnNumber != -1)
{ {
errors.push_back(StorageError( errors.push_back(StorageError(
id, utility::decodeFromUtf8(message), utility::decodeFromUtf8(filePath), lineNumber, columnNumber, fatal, indexed) id, utility::decodeFromUtf8(message), utility::decodeFromUtf8(filePath), lineNumber, columnNumber, utility::decodeFromUtf8(translationUnit), fatal, indexed)
); );
id++; id++;
} }
+6
View File
@@ -13,6 +13,7 @@ struct StorageErrorData
, filePath(L"") , filePath(L"")
, lineNumber(-1) , lineNumber(-1)
, columnNumber(-1) , columnNumber(-1)
, translationUnit(L"")
, fatal(0) , fatal(0)
, indexed(0) , indexed(0)
{} {}
@@ -22,6 +23,7 @@ struct StorageErrorData
const std::wstring& filePath, const std::wstring& filePath,
uint lineNumber, uint lineNumber,
uint columnNumber, uint columnNumber,
const std::wstring& translationUnit,
bool fatal, bool fatal,
bool indexed bool indexed
) )
@@ -29,6 +31,7 @@ struct StorageErrorData
, filePath(filePath) , filePath(filePath)
, lineNumber(lineNumber) , lineNumber(lineNumber)
, columnNumber(columnNumber) , columnNumber(columnNumber)
, translationUnit(translationUnit)
, fatal(fatal) , fatal(fatal)
, indexed(indexed) , indexed(indexed)
{} {}
@@ -39,6 +42,7 @@ struct StorageErrorData
uint lineNumber; uint lineNumber;
uint columnNumber; uint columnNumber;
std::wstring translationUnit;
bool fatal; bool fatal;
bool indexed; bool indexed;
}; };
@@ -61,6 +65,7 @@ struct StorageError: public StorageErrorData
const std::wstring& filePath, const std::wstring& filePath,
uint lineNumber, uint lineNumber,
uint columnNumber, uint columnNumber,
const std::wstring& translationUnit,
bool fatal, bool fatal,
bool indexed bool indexed
) )
@@ -69,6 +74,7 @@ struct StorageError: public StorageErrorData
filePath, filePath,
lineNumber, lineNumber,
columnNumber, columnNumber,
translationUnit,
fatal, fatal,
indexed indexed
) )
@@ -16,12 +16,14 @@ CxxDiagnosticConsumer::CxxDiagnosticConsumer(
std::shared_ptr<ParserClient> client, std::shared_ptr<ParserClient> client,
std::shared_ptr<FileRegister> fileRegister, std::shared_ptr<FileRegister> fileRegister,
std::shared_ptr<CanonicalFilePathCache> canonicalFilePathCache, std::shared_ptr<CanonicalFilePathCache> canonicalFilePathCache,
const FilePath& sourceFilePath,
bool useLogging bool useLogging
) )
: clang::TextDiagnosticPrinter(os, diags) : clang::TextDiagnosticPrinter(os, diags)
, m_client(client) , m_client(client)
, m_register(fileRegister) , m_register(fileRegister)
, m_canonicalFilePathCache(canonicalFilePathCache) , m_canonicalFilePathCache(canonicalFilePathCache)
, m_sourceFilePath(sourceFilePath)
, m_isParsingFile(false) , m_isParsingFile(false)
, m_useLogging(useLogging) , m_useLogging(useLogging)
{ {
@@ -34,6 +36,8 @@ void CxxDiagnosticConsumer::BeginSourceFile(const clang::LangOptions& langOption
clang::TextDiagnosticPrinter::BeginSourceFile(langOptions, preProcessor); clang::TextDiagnosticPrinter::BeginSourceFile(langOptions, preProcessor);
} }
m_isParsingFile = true; m_isParsingFile = true;
} }
@@ -107,7 +111,8 @@ void CxxDiagnosticConsumer::HandleDiagnostic(clang::DiagnosticsEngine::Level lev
location, location,
utility::decodeFromUtf8(message), utility::decodeFromUtf8(message),
level == clang::DiagnosticsEngine::Fatal, level == clang::DiagnosticsEngine::Fatal,
m_register->hasFilePath(location.filePath) m_register->hasFilePath(location.filePath),
m_sourceFilePath
); );
} }
} }
@@ -2,6 +2,7 @@
#define CXX_DIAGNOSTIC_CONSUMER #define CXX_DIAGNOSTIC_CONSUMER
#include "clang/Frontend/TextDiagnosticPrinter.h" #include "clang/Frontend/TextDiagnosticPrinter.h"
#include "utility/file/FilePath.h"
class CanonicalFilePathCache; class CanonicalFilePathCache;
class FileRegister; class FileRegister;
@@ -17,6 +18,7 @@ public:
std::shared_ptr<ParserClient> client, std::shared_ptr<ParserClient> client,
std::shared_ptr<FileRegister> fileRegister, std::shared_ptr<FileRegister> fileRegister,
std::shared_ptr<CanonicalFilePathCache> canonicalFilePathCache, std::shared_ptr<CanonicalFilePathCache> canonicalFilePathCache,
const FilePath& sourceFilePath,
bool useLogging = true bool useLogging = true
); );
@@ -30,6 +32,7 @@ private:
std::shared_ptr<FileRegister> m_register; std::shared_ptr<FileRegister> m_register;
std::shared_ptr<CanonicalFilePathCache> m_canonicalFilePathCache; std::shared_ptr<CanonicalFilePathCache> m_canonicalFilePathCache;
const FilePath m_sourceFilePath;
bool m_isParsingFile; bool m_isParsingFile;
bool m_useLogging; bool m_useLogging;
}; };
+5 -4
View File
@@ -110,7 +110,7 @@ void CxxParser::buildIndex(const std::wstring& fileName, std::shared_ptr<TextAcc
{ {
std::shared_ptr<CanonicalFilePathCache> canonicalFilePathCache = std::make_shared<CanonicalFilePathCache>(); std::shared_ptr<CanonicalFilePathCache> canonicalFilePathCache = std::make_shared<CanonicalFilePathCache>();
std::shared_ptr<CxxDiagnosticConsumer> diagnostics = getDiagnostics(canonicalFilePathCache, false); std::shared_ptr<CxxDiagnosticConsumer> diagnostics = getDiagnostics(FilePath(), canonicalFilePathCache, false);
ASTActionFactory actionFactory(m_client, m_fileRegister, canonicalFilePathCache); ASTActionFactory actionFactory(m_client, m_fileRegister, canonicalFilePathCache);
std::vector<std::string> args = getCommandlineArgumentsEssential(compilerFlags, std::vector<FilePath>(), std::vector<FilePath>()); std::vector<std::string> args = getCommandlineArgumentsEssential(compilerFlags, std::vector<FilePath>(), std::vector<FilePath>());
@@ -130,7 +130,7 @@ void CxxParser::runTool(clang::tooling::CompilationDatabase* compilationDatabase
std::shared_ptr<CanonicalFilePathCache> canonicalFilePathCache = std::make_shared<CanonicalFilePathCache>(); std::shared_ptr<CanonicalFilePathCache> canonicalFilePathCache = std::make_shared<CanonicalFilePathCache>();
std::shared_ptr<CxxDiagnosticConsumer> diagnostics = getDiagnostics(canonicalFilePathCache, true); std::shared_ptr<CxxDiagnosticConsumer> diagnostics = getDiagnostics(sourceFilePath, canonicalFilePathCache, true);
tool.setDiagnosticConsumer(diagnostics.get()); tool.setDiagnosticConsumer(diagnostics.get());
@@ -195,9 +195,10 @@ std::vector<std::string> CxxParser::getCommandlineArguments(std::shared_ptr<Inde
return args; return args;
} }
std::shared_ptr<CxxDiagnosticConsumer> CxxParser::getDiagnostics(std::shared_ptr<CanonicalFilePathCache> canonicalFilePathCache, bool logErrors) const std::shared_ptr<CxxDiagnosticConsumer> CxxParser::getDiagnostics(const FilePath& sourceFilePath, std::shared_ptr<CanonicalFilePathCache> canonicalFilePathCache, bool logErrors) const
{ {
llvm::IntrusiveRefCntPtr<clang::DiagnosticOptions> options = new clang::DiagnosticOptions(); llvm::IntrusiveRefCntPtr<clang::DiagnosticOptions> options = new clang::DiagnosticOptions();
return std::make_shared<CxxDiagnosticConsumer>( return std::make_shared<CxxDiagnosticConsumer>(
llvm::errs(), &*options, m_client, m_fileRegister, canonicalFilePathCache, logErrors); llvm::errs(), &*options, m_client, m_fileRegister, canonicalFilePathCache, sourceFilePath, logErrors
);
} }
+2 -1
View File
@@ -37,7 +37,8 @@ private:
const std::vector<FilePath>& frameworkSearchPaths) const; const std::vector<FilePath>& frameworkSearchPaths) const;
std::vector<std::string> getCommandlineArguments(std::shared_ptr<IndexerCommandCxxEmpty> indexerCommand) const; std::vector<std::string> getCommandlineArguments(std::shared_ptr<IndexerCommandCxxEmpty> indexerCommand) const;
std::shared_ptr<CxxDiagnosticConsumer> getDiagnostics(std::shared_ptr<CanonicalFilePathCache> canonicalFilePathCache, bool logErrors) const; std::shared_ptr<CxxDiagnosticConsumer> getDiagnostics(
const FilePath& sourceFilePath, std::shared_ptr<CanonicalFilePathCache> canonicalFilePathCache, bool logErrors) const;
friend class TaskParseCxx; friend class TaskParseCxx;
+22 -18
View File
@@ -86,14 +86,15 @@ void QtErrorView::initView()
// Setup Table Headers // Setup Table Headers
m_model->setColumnCount(COLUMN_MAX + 1); m_model->setColumnCount(COLUMN_MAX + 1);
m_table->setColumnWidth(COLUMN::ID, 40); m_table->setColumnWidth(Column::ID, 40);
m_table->setColumnWidth(COLUMN::TYPE, 80); m_table->setColumnWidth(Column::TYPE, 80);
m_table->setColumnWidth(COLUMN::MESSAGE, 450); m_table->setColumnWidth(Column::MESSAGE, 450);
m_table->setColumnWidth(COLUMN::FILE, 300); m_table->setColumnWidth(Column::FILE, 300);
m_table->setColumnWidth(COLUMN::LINE, 50); m_table->setColumnWidth(Column::LINE, 50);
m_table->setColumnWidth(Column::TRANSLATION_UNIT, 300);
QStringList headers; QStringList headers;
headers << "ID" << "Type" << "Message" << "File" << "Line" << "Indexed"; headers << "ID" << "Type" << "Message" << "File" << "Line" << "Indexed" << "Translation Unit";
m_model->setHorizontalHeaderLabels(headers); m_model->setHorizontalHeaderLabels(headers);
connect(m_table->selectionModel(), &QItemSelectionModel::currentRowChanged, connect(m_table->selectionModel(), &QItemSelectionModel::currentRowChanged,
@@ -101,12 +102,12 @@ void QtErrorView::initView()
{ {
if (index.isValid() && !m_ignoreRowSelection) if (index.isValid() && !m_ignoreRowSelection)
{ {
if (m_model->item(index.row(), COLUMN::FILE) == nullptr) if (m_model->item(index.row(), Column::FILE) == nullptr)
{ {
return; return;
} }
Id errorId = m_model->item(index.row(), COLUMN::ID)->text().toUInt(); Id errorId = m_model->item(index.row(), Column::ID)->text().toUInt();
m_controllerProxy.executeAsTaskWithArgs(&ErrorController::showError, errorId); m_controllerProxy.executeAsTaskWithArgs(&ErrorController::showError, errorId);
} }
@@ -263,7 +264,7 @@ void QtErrorView::setErrorId(Id errorId)
{ {
m_onQtThread([=]() m_onQtThread([=]()
{ {
QList<QStandardItem*> items = m_model->findItems(QString::number(errorId), Qt::MatchExactly, COLUMN::ID); QList<QStandardItem*> items = m_model->findItems(QString::number(errorId), Qt::MatchExactly, Column::ID);
if (items.size() == 1) if (items.size() == 1)
{ {
@@ -360,25 +361,28 @@ void QtErrorView::addErrorToTable(const ErrorInfo& error)
QStandardItem *item = new QStandardItem(); QStandardItem *item = new QStandardItem();
item->setData(QVariant(qlonglong(error.id)), Qt::DisplayRole); item->setData(QVariant(qlonglong(error.id)), Qt::DisplayRole);
m_model->setItem(rowNumber, COLUMN::ID, item); m_model->setItem(rowNumber, Column::ID, item);
m_model->setItem(rowNumber, COLUMN::TYPE, new QStandardItem(error.fatal ? "FATAL" : "ERROR")); m_model->setItem(rowNumber, Column::TYPE, new QStandardItem(error.fatal ? "FATAL" : "ERROR"));
if (error.fatal) if (error.fatal)
{ {
m_model->item(rowNumber, COLUMN::TYPE)->setForeground(QBrush(Qt::red)); m_model->item(rowNumber, Column::TYPE)->setForeground(QBrush(Qt::red));
} }
m_model->item(rowNumber, COLUMN::TYPE)->setIcon(s_errorIcon); m_model->item(rowNumber, Column::TYPE)->setIcon(s_errorIcon);
m_model->setItem(rowNumber, COLUMN::MESSAGE, new QStandardItem(QString::fromStdWString(error.message))); m_model->setItem(rowNumber, Column::MESSAGE, new QStandardItem(QString::fromStdWString(error.message)));
m_model->setItem(rowNumber, COLUMN::FILE, new QStandardItem(QString::fromStdWString(error.filePath))); m_model->setItem(rowNumber, Column::FILE, new QStandardItem(QString::fromStdWString(error.filePath)));
m_model->item(rowNumber, COLUMN::FILE)->setToolTip(QString::fromStdWString(error.filePath)); m_model->item(rowNumber, Column::FILE)->setToolTip(QString::fromStdWString(error.filePath));
item = new QStandardItem(); item = new QStandardItem();
item->setData(QVariant(error.lineNumber), Qt::DisplayRole); item->setData(QVariant(error.lineNumber), Qt::DisplayRole);
m_model->setItem(rowNumber, COLUMN::LINE, item); m_model->setItem(rowNumber, Column::LINE, item);
m_model->setItem(rowNumber, COLUMN::INDEXED, new QStandardItem(error.indexed ? "yes" : "no")); m_model->setItem(rowNumber, Column::INDEXED, new QStandardItem(error.indexed ? "yes" : "no"));
m_model->setItem(rowNumber, Column::TRANSLATION_UNIT, new QStandardItem(QString::fromStdWString(error.translationUnit)));
m_model->item(rowNumber, Column::TRANSLATION_UNIT)->setToolTip(QString::fromStdWString(error.translationUnit));
} }
QCheckBox* QtErrorView::createFilterCheckbox(const QString& name, bool checked, QBoxLayout* layout) QCheckBox* QtErrorView::createFilterCheckbox(const QString& name, bool checked, QBoxLayout* layout)
+4 -2
View File
@@ -48,14 +48,16 @@ private slots:
void errorFilterChanged(int i = 0); void errorFilterChanged(int i = 0);
private: private:
enum COLUMN { enum Column
{
ID = 0, ID = 0,
TYPE = 1, TYPE = 1,
MESSAGE = 2, MESSAGE = 2,
FILE = 3, FILE = 3,
LINE = 4, LINE = 4,
INDEXED = 5, INDEXED = 5,
COLUMN_MAX = INDEXED TRANSLATION_UNIT = 6,
COLUMN_MAX = TRANSLATION_UNIT
}; };
void setStyleSheet() const; void setStyleSheet() const;
+2 -1
View File
@@ -265,6 +265,7 @@ void JavaParser::doRecordError(
ParseLocation(m_currentFilePath, beginLine, beginColumn, endLine, endColumn), ParseLocation(m_currentFilePath, beginLine, beginColumn, endLine, endColumn),
utility::decodeFromUtf8(m_javaEnvironment->toStdString(jMessage)), utility::decodeFromUtf8(m_javaEnvironment->toStdString(jMessage)),
fatal, fatal,
indexed indexed,
FilePath()
); );
} }
+1 -1
View File
@@ -97,7 +97,7 @@ public:
private: private:
virtual void doRecordError(const ParseLocation& location, const std::wstring& message, virtual void doRecordError(const ParseLocation& location, const std::wstring& message,
bool fatal, bool indexed) override bool fatal, bool indexed, const FilePath& translationUnit) override
{ {
recordLine(L"ERROR: " + addLocationSuffix(message + L" [" + location.filePath.fileName(), location) + L"]\n"); recordLine(L"ERROR: " + addLocationSuffix(message + L" [" + location.filePath.fileName(), location) + L"]\n");
} }
+2 -1
View File
@@ -166,7 +166,8 @@ private:
const ParseLocation& location, const ParseLocation& location,
const std::wstring& message, const std::wstring& message,
bool fatal, bool fatal,
bool indexed) override bool indexed,
const FilePath& translationUnit) override
{ {
if (location.isValid()) if (location.isValid())
{ {