ui: display fatal errors

* added ErrorCountInfo to incorporate reporting of fatal errors during code analysis.
This commit is contained in:
malte_langkabel
2016-03-02 10:53:04 +01:00
parent 4425b39ea1
commit 2ebfbbf88e
21 changed files with 105 additions and 213 deletions
-167
View File
@@ -1,189 +1,22 @@
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config. ConfigManager.cpp WARNING: value source/header_search_paths/header_search_path is not present in config.
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
CxxDeclNameResolver.cpp ERROR: could not resolve name of decl at: input.cc:1:20 CxxDeclNameResolver.cpp ERROR: could not resolve name of decl at: input.cc:1:20
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
CxxDeclNameResolver.cpp ERROR: could not resolve name of decl at: input.cc:4:20 CxxDeclNameResolver.cpp ERROR: could not resolve name of decl at: input.cc:4:20
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
CxxDeclNameResolver.cpp ERROR: could not resolve name of decl at: input.cc:1:20 CxxDeclNameResolver.cpp ERROR: could not resolve name of decl at: input.cc:1:20
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
CxxDeclNameResolver.cpp ERROR: could not resolve name of decl at: input.cc:1:11 CxxDeclNameResolver.cpp ERROR: could not resolve name of decl at: input.cc:1:11
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
CxxDeclNameResolver.cpp ERROR: could not resolve name of decl at: input.cc:4:20 CxxDeclNameResolver.cpp ERROR: could not resolve name of decl at: input.cc:4:20
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
CxxDeclNameResolver.cpp ERROR: could not resolve name of decl at: input.cc:1:13 CxxDeclNameResolver.cpp ERROR: could not resolve name of decl at: input.cc:1:13
CxxDeclNameResolver.cpp ERROR: could not resolve name of decl at: input.cc:7:15 CxxDeclNameResolver.cpp ERROR: could not resolve name of decl at: input.cc:7:15
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
CxxDeclNameResolver.cpp ERROR: could not resolve name of decl at: input.cc:4:20 CxxDeclNameResolver.cpp ERROR: could not resolve name of decl at: input.cc:4:20
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
CxxDeclNameResolver.cpp ERROR: could not resolve name of decl at: input.cc:4:20 CxxDeclNameResolver.cpp ERROR: could not resolve name of decl at: input.cc:4:20
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
CxxDeclNameResolver.cpp ERROR: could not resolve name of decl at: input.cc:4:20 CxxDeclNameResolver.cpp ERROR: could not resolve name of decl at: input.cc:4:20
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
CxxDeclNameResolver.cpp ERROR: could not resolve name of decl at: input.cc:5:20 CxxDeclNameResolver.cpp ERROR: could not resolve name of decl at: input.cc:5:20
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
CxxDeclNameResolver.cpp ERROR: could not resolve name of decl at: input.cc:4:20 CxxDeclNameResolver.cpp ERROR: could not resolve name of decl at: input.cc:4:20
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
CxxDeclNameResolver.cpp ERROR: could not resolve name of decl at: input.cc:4:20 CxxDeclNameResolver.cpp ERROR: could not resolve name of decl at: input.cc:4:20
CxxDeclNameResolver.cpp ERROR: could not resolve name of decl at: input.cc:4:48 CxxDeclNameResolver.cpp ERROR: could not resolve name of decl at: input.cc:4:48
CxxDeclNameResolver.cpp ERROR: could not resolve name of decl at: input.cc:7:20 CxxDeclNameResolver.cpp ERROR: could not resolve name of decl at: input.cc:7:20
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
CxxDeclNameResolver.cpp ERROR: could not resolve name of decl at: input.cc:4:20 CxxDeclNameResolver.cpp ERROR: could not resolve name of decl at: input.cc:4:20
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
CxxDeclNameResolver.cpp ERROR: could not resolve name of decl at: input.cc:3:20 CxxDeclNameResolver.cpp ERROR: could not resolve name of decl at: input.cc:3:20
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
CxxDeclNameResolver.cpp ERROR: could not resolve name of decl at: input.cc:4:20 CxxDeclNameResolver.cpp ERROR: could not resolve name of decl at: input.cc:4:20
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Settings.cpp WARNING: File for Settings not found: data/TestSettings.xml
Token.cpp ERROR: Location Id was not referenced by this Token. Token.cpp ERROR: Location Id was not referenced by this Token.
Node.cpp WARNING: Cannot change NodeType after it was already set from namespace to class Node.cpp WARNING: Cannot change NodeType after it was already set from namespace to class
Edge.cpp ERROR: Nodes are not plain copies. Edge.cpp ERROR: Nodes are not plain copies.
+1
View File
@@ -158,6 +158,7 @@ add_files(
data/type/ReferenceModifiedDataType.cpp data/type/ReferenceModifiedDataType.cpp
data/type/ReferenceModifiedDataType.h data/type/ReferenceModifiedDataType.h
data/ErrorCountInfo.h
data/HierarchyCache.cpp data/HierarchyCache.cpp
data/HierarchyCache.h data/HierarchyCache.h
data/SqliteStorage.cpp data/SqliteStorage.cpp
@@ -65,12 +65,12 @@ void CodeController::handleMessage(MessageActivateAll* message)
ss << "\t" + std::to_string(stats.nodeCount) + " symbols\n"; ss << "\t" + std::to_string(stats.nodeCount) + " symbols\n";
ss << "\t" + std::to_string(stats.edgeCount) + " relations\n"; ss << "\t" + std::to_string(stats.edgeCount) + " relations\n";
ss << "\n"; ss << "\n";
ss << "\t" + std::to_string(stats.errorCount) + " errors\n"; ss << "\t" + std::to_string(stats.errorCount.total) + " errors (" + std::to_string(stats.errorCount.fatal) + " fatal)\n";
ss << "\n"; ss << "\n";
if (stats.errorCount > 0) if (stats.errorCount.total > 0)
{ {
ss << "\tWarning: The analysis may be incomplete as long as it yields errors.\n"; ss << "\tWarning: The analysis may be incomplete as long as it yields fatal errors.\n";
ss << "\tTry resolving them and refresh the project.\n"; ss << "\tTry resolving them and refresh the project.\n";
ss << "\n"; ss << "\n";
} }
@@ -19,7 +19,7 @@ StatusBarView* StatusBarController::getView()
void StatusBarController::handleMessage(MessageClearErrorCount* message) void StatusBarController::handleMessage(MessageClearErrorCount* message)
{ {
getView()->setErrorCount(0); getView()->setErrorCount(ErrorCountInfo());
} }
void StatusBarController::handleMessage(MessageFinishedParsing* message) void StatusBarController::handleMessage(MessageFinishedParsing* message)
@@ -29,7 +29,7 @@ void StatusBarController::handleMessage(MessageFinishedParsing* message)
void StatusBarController::handleMessage(MessageShowErrors* message) void StatusBarController::handleMessage(MessageShowErrors* message)
{ {
if (message->errorCount >= 0) if (message->errorCount.total >= 0)
{ {
getView()->setErrorCount(message->errorCount); getView()->setErrorCount(message->errorCount);
} }
@@ -126,7 +126,7 @@ std::shared_ptr<MessageActivateTokens> ActivationTranslator::translateMessage(co
else if (match.searchType == SearchMatch::SEARCH_COMMAND && else if (match.searchType == SearchMatch::SEARCH_COMMAND &&
match.getFullName() == SearchMatch::getCommandName(SearchMatch::COMMAND_ERROR)) match.getFullName() == SearchMatch::getCommandName(SearchMatch::COMMAND_ERROR))
{ {
MessageShowErrors msg(-1); MessageShowErrors msg(ErrorCountInfo(-1, 0));
msg.undoRedoType = message->undoRedoType; msg.undoRedoType = message->undoRedoType;
msg.dispatchImmediately(); msg.dispatchImmediately();
return nullptr; return nullptr;
+2 -1
View File
@@ -2,6 +2,7 @@
#define STATUS_BAR_VIEW_H #define STATUS_BAR_VIEW_H
#include "component/view/View.h" #include "component/view/View.h"
#include "data/ErrorCountInfo.h"
class StatusBarController; class StatusBarController;
@@ -13,7 +14,7 @@ public:
virtual std::string getName() const; virtual std::string getName() const;
virtual void showMessage(const std::string& message, bool isError, bool showLoader) = 0; virtual void showMessage(const std::string& message, bool isError, bool showLoader) = 0;
virtual void setErrorCount(size_t count) = 0; virtual void setErrorCount(ErrorCountInfo errorCount) = 0;
protected: protected:
StatusBarController* getController(); StatusBarController* getController();
+20
View File
@@ -0,0 +1,20 @@
#ifndef ERROR_COUNT_INFO_H
#define ERROR_COUNT_INFO_H
struct ErrorCountInfo
{
ErrorCountInfo()
: total(0)
, fatal(0)
{}
ErrorCountInfo(int total, size_t fatal)
: total(total)
, fatal(fatal)
{}
int total;
size_t fatal;
};
#endif // ERROR_COUNT_INFO_H
+25 -3
View File
@@ -169,9 +169,9 @@ Id SqliteStorage::addCommentLocation(Id fileNodeId, uint startLine, uint startCo
return m_database.lastRowId(); return m_database.lastRowId();
} }
Id SqliteStorage::addError(const std::string& message, const std::string& filePath, uint lineNumber, uint columnNumber) Id SqliteStorage::addError(const std::string& message, bool fatal, const std::string& filePath, uint lineNumber, uint columnNumber)
{ {
std::string sanitizedMessage = utility::replace(message, "'", "''"); std::string sanitizedMessage = utility::replace((fatal ? "Fatal: " : "") + message, "'", "''");
// check for duplicate // check for duplicate
CppSQLite3Query q = m_database.execQuery(( CppSQLite3Query q = m_database.execQuery((
@@ -630,7 +630,29 @@ std::vector<StorageError> SqliteStorage::getAllErrors() const
{ {
CppSQLite3Query q = m_database.execQuery( CppSQLite3Query q = m_database.execQuery(
"SELECT message, file_path, line_number, column_number FROM error;" "SELECT message, file_path, line_number, column_number FROM error;"
); );
std::vector<StorageError> errors;
while (!q.eof())
{
const std::string message = q.getStringField(0, "");
const std::string filePath = q.getStringField(1, "");
const uint lineNumber = q.getIntField(2, 0);
const uint columnNumber = q.getIntField(3, 0);
errors.push_back(StorageError(message, filePath, lineNumber, columnNumber));
q.nextRow();
}
return errors;
}
std::vector<StorageError> SqliteStorage::getFatalErrors() const
{
CppSQLite3Query q = m_database.execQuery(
"SELECT message, file_path, line_number, column_number FROM error WHERE message LIKE 'Fatal: %';"
);
std::vector<StorageError> errors; std::vector<StorageError> errors;
while (!q.eof()) while (!q.eof())
+2 -1
View File
@@ -42,7 +42,7 @@ public:
Id addComponentAccess(Id memberEdgeId, int type); Id addComponentAccess(Id memberEdgeId, int type);
Id addCommentLocation(Id fileNodeId, uint startLine, uint startCol, uint endLine, uint endCol); Id addCommentLocation(Id fileNodeId, uint startLine, uint startCol, uint endLine, uint endCol);
Id addError(const std::string& message, const std::string& filePath, uint lineNumber, uint columnNumber); Id addError(const std::string& message, bool fatal, const std::string& filePath, uint lineNumber, uint columnNumber);
void removeElement(Id id); void removeElement(Id id);
void removeElements(const std::vector<Id>& ids); void removeElements(const std::vector<Id>& ids);
@@ -95,6 +95,7 @@ public:
std::vector<StorageCommentLocation> getCommentLocationsInFile(const FilePath& filePath) const; std::vector<StorageCommentLocation> getCommentLocationsInFile(const FilePath& filePath) const;
std::vector<StorageError> getAllErrors() const; std::vector<StorageError> getAllErrors() const;
std::vector<StorageError> getFatalErrors() const;
int getNodeCount() const; int getNodeCount() const;
int getEdgeCount() const; int getEdgeCount() const;
+7 -7
View File
@@ -188,20 +188,20 @@ void Storage::finishParsingFile(const FilePath& filePath)
m_sqliteStorage.commitTransaction(); m_sqliteStorage.commitTransaction();
} }
void Storage::onError(const ParseLocation& location, const std::string& message) void Storage::onError(const ParseLocation& location, const std::string& message, bool fatal)
{ {
log("ERROR", message, location); log(std::string(fatal ? "FATAL " : "") + "ERROR", message, location);
if (!location.isValid()) if (!location.isValid())
{ {
return; return;
} }
size_t errorCount = getErrorCount(); size_t totalErrorCount = getErrorCount().total;
m_sqliteStorage.addError(message, location.filePath.str(), location.startLineNumber, location.startColumnNumber); m_sqliteStorage.addError(message, fatal, location.filePath.str(), location.startLineNumber, location.startColumnNumber);
if (errorCount != getErrorCount()) if (totalErrorCount != getErrorCount().total)
{ {
MessageShowErrors msg(getErrorCount()); MessageShowErrors msg(getErrorCount());
msg.setSendAsTask(false); msg.setSendAsTask(false);
@@ -209,9 +209,9 @@ void Storage::onError(const ParseLocation& location, const std::string& message)
} }
} }
size_t Storage::getErrorCount() const ErrorCountInfo Storage::getErrorCount() const
{ {
return m_sqliteStorage.getAllErrors().size(); return ErrorCountInfo(m_sqliteStorage.getAllErrors().size(), m_sqliteStorage.getFatalErrors().size());
} }
Id Storage::onTypedefParsed( Id Storage::onTypedefParsed(
+2 -2
View File
@@ -46,8 +46,8 @@ public:
virtual void startParsingFile(const FilePath& filePath); virtual void startParsingFile(const FilePath& filePath);
virtual void finishParsingFile(const FilePath& filePath); virtual void finishParsingFile(const FilePath& filePath);
virtual void onError(const ParseLocation& location, const std::string& message); virtual void onError(const ParseLocation& location, const std::string& message, bool fatal);
virtual size_t getErrorCount() const; virtual ErrorCountInfo getErrorCount() const;
virtual Id onTypedefParsed( virtual Id onTypedefParsed(
const ParseLocation& location, const NameHierarchy& typedefName, AccessType access); const ParseLocation& location, const NameHierarchy& typedefName, AccessType access);
+4 -2
View File
@@ -1,6 +1,8 @@
#ifndef STORAGE_STATS_H #ifndef STORAGE_STATS_H
#define STORAGE_STATS_H #define STORAGE_STATS_H
#include "data/ErrorCountInfo.h"
struct StorageStats struct StorageStats
{ {
StorageStats() StorageStats()
@@ -12,7 +14,7 @@ struct StorageStats
, fileCount(0) , fileCount(0)
, fileLOCCount(0) , fileLOCCount(0)
, sourceLocationCount(0) , sourceLocationCount(0)
, errorCount(0) , errorCount(ErrorCountInfo())
{} {}
size_t nodeCount; size_t nodeCount;
@@ -26,7 +28,7 @@ struct StorageStats
size_t fileLOCCount; size_t fileLOCCount;
size_t sourceLocationCount; size_t sourceLocationCount;
size_t errorCount; ErrorCountInfo errorCount;
}; };
#endif // STORAGE_STATS_H #endif // STORAGE_STATS_H
+3 -2
View File
@@ -6,6 +6,7 @@
#include "utility/types.h" #include "utility/types.h"
#include "data/name/NameHierarchy.h" #include "data/name/NameHierarchy.h"
#include "data/ErrorCountInfo.h"
#include "utility/file/FileInfo.h" #include "utility/file/FileInfo.h"
@@ -61,8 +62,8 @@ public:
virtual void startParsingFile(const FilePath& filePath) = 0; virtual void startParsingFile(const FilePath& filePath) = 0;
virtual void finishParsingFile(const FilePath& filePath) = 0; virtual void finishParsingFile(const FilePath& filePath) = 0;
virtual void onError(const ParseLocation& location, const std::string& message) = 0; virtual void onError(const ParseLocation& location, const std::string& message, bool fatal) = 0;
virtual size_t getErrorCount() const = 0; virtual ErrorCountInfo getErrorCount() const = 0;
virtual Id onTypedefParsed( virtual Id onTypedefParsed(
const ParseLocation& location, const NameHierarchy& typedefName, AccessType access) = 0; const ParseLocation& location, const NameHierarchy& typedefName, AccessType access) = 0;
@@ -4,6 +4,7 @@
#include <sstream> #include <sstream>
#include <iomanip> #include <iomanip>
#include "data/ErrorCountInfo.h"
#include "utility/messaging/Message.h" #include "utility/messaging/Message.h"
#include "utility/messaging/type/MessageStatus.h" #include "utility/messaging/type/MessageStatus.h"
@@ -11,7 +12,7 @@ class MessageFinishedParsing
: public Message<MessageFinishedParsing> : public Message<MessageFinishedParsing>
{ {
public: public:
MessageFinishedParsing(size_t fileCount, size_t totalFileCount, float parseTime, size_t errorCount) MessageFinishedParsing(size_t fileCount, size_t totalFileCount, float parseTime, ErrorCountInfo errorCount)
: fileCount(fileCount) : fileCount(fileCount)
, totalFileCount(totalFileCount) , totalFileCount(totalFileCount)
, parseTime(parseTime) , parseTime(parseTime)
@@ -26,7 +27,7 @@ public:
virtual void dispatch() virtual void dispatch()
{ {
MessageStatus(getStatusStr(), errorCount > 0).dispatch(); MessageStatus(getStatusStr(), errorCount.total > 0).dispatch();
Message<MessageFinishedParsing>::dispatch(); Message<MessageFinishedParsing>::dispatch();
} }
@@ -37,7 +38,11 @@ public:
ss << "Finished analysis: "; ss << "Finished analysis: ";
ss << fileCount << "/" << totalFileCount << " files, "; ss << fileCount << "/" << totalFileCount << " files, ";
ss << std::setprecision(2) << std::fixed << parseTime << " seconds, "; ss << std::setprecision(2) << std::fixed << parseTime << " seconds, ";
ss << errorCount << " error(s)"; ss << errorCount.total << " error" << (errorCount.total > 1 ? "s" : "");
if (errorCount.fatal > 0)
{
ss << " (" << errorCount.fatal << " fatal)";
}
return ss.str(); return ss.str();
} }
@@ -49,7 +54,7 @@ public:
size_t fileCount; size_t fileCount;
size_t totalFileCount; size_t totalFileCount;
float parseTime; float parseTime;
size_t errorCount; ErrorCountInfo errorCount;
}; };
#endif // MESSAGE_FINISHED_PARSING_H #endif // MESSAGE_FINISHED_PARSING_H
@@ -1,13 +1,14 @@
#ifndef MESSAGE_SHOW_ERRORS_H #ifndef MESSAGE_SHOW_ERRORS_H
#define MESSAGE_SHOW_ERRORS_H #define MESSAGE_SHOW_ERRORS_H
#include "data/ErrorCountInfo.h"
#include "utility/messaging/Message.h" #include "utility/messaging/Message.h"
class MessageShowErrors class MessageShowErrors
: public Message<MessageShowErrors> : public Message<MessageShowErrors>
{ {
public: public:
MessageShowErrors(int errorCount) MessageShowErrors(ErrorCountInfo errorCount)
: errorCount(errorCount) : errorCount(errorCount)
{ {
} }
@@ -17,7 +18,7 @@ public:
return "MessageShowErrors"; return "MessageShowErrors";
} }
int errorCount; ErrorCountInfo errorCount;
}; };
#endif // MESSAGE_SHOW_ERRORS_H #endif // MESSAGE_SHOW_ERRORS_H
+5 -3
View File
@@ -64,11 +64,13 @@ void QtStatusBar::setText(const std::string& text, bool isError, bool showLoader
m_text.setText(text.c_str()); m_text.setText(text.c_str());
} }
void QtStatusBar::setErrorCount(size_t count) void QtStatusBar::setErrorCount(ErrorCountInfo errorCount)
{ {
if (count > 0) if (errorCount.total > 0)
{ {
m_errorButton.setText(QString::number(count) + " error(s)"); m_errorButton.setText(
QString::number(errorCount.total) + " error" + (errorCount.total > 1 ? "s" : "") +
(errorCount.fatal > 0 ? "(" + QString::number(errorCount.fatal) + " fatal)" : ""));
m_errorButton.show(); m_errorButton.show();
} }
else else
+3 -1
View File
@@ -7,6 +7,8 @@
#include <QLabel> #include <QLabel>
#include <QStatusBar> #include <QStatusBar>
#include "data/ErrorCountInfo.h"
class QtStatusBar class QtStatusBar
: public QStatusBar : public QStatusBar
{ {
@@ -17,7 +19,7 @@ public:
virtual ~QtStatusBar(void); virtual ~QtStatusBar(void);
void setText(const std::string& text, bool isError, bool showLoader); void setText(const std::string& text, bool isError, bool showLoader);
void setErrorCount(size_t count); void setErrorCount(ErrorCountInfo errorCount);
private slots: private slots:
void showErrors(); void showErrors();
+4 -4
View File
@@ -40,9 +40,9 @@ void QtStatusBarView::showMessage(const std::string& message, bool isError, bool
m_showMessageFunctor(message, isError, showLoader); m_showMessageFunctor(message, isError, showLoader);
} }
void QtStatusBarView::setErrorCount(size_t count) void QtStatusBarView::setErrorCount(ErrorCountInfo errorCount)
{ {
m_setErrorCountFunctor(count); m_setErrorCountFunctor(errorCount);
} }
void QtStatusBarView::doShowMessage(const std::string& message, bool isError, bool showLoader) void QtStatusBarView::doShowMessage(const std::string& message, bool isError, bool showLoader)
@@ -50,7 +50,7 @@ void QtStatusBarView::doShowMessage(const std::string& message, bool isError, bo
m_widget->setText(message, isError, showLoader); m_widget->setText(message, isError, showLoader);
} }
void QtStatusBarView::doSetErrorCount(size_t count) void QtStatusBarView::doSetErrorCount(ErrorCountInfo errorCount)
{ {
m_widget->setErrorCount(count); m_widget->setErrorCount(errorCount);
} }
+4 -3
View File
@@ -5,6 +5,7 @@
#include <string> #include <string>
#include "component/view/StatusBarView.h" #include "component/view/StatusBarView.h"
#include "data/ErrorCountInfo.h"
#include "qt/element/QtStatusBar.h" #include "qt/element/QtStatusBar.h"
#include "qt/utility/QtThreadedFunctor.h" #include "qt/utility/QtThreadedFunctor.h"
@@ -22,14 +23,14 @@ public:
// StatusBar view implementation // StatusBar view implementation
virtual void showMessage(const std::string& message, bool isError, bool showLoader); virtual void showMessage(const std::string& message, bool isError, bool showLoader);
virtual void setErrorCount(size_t count); virtual void setErrorCount(ErrorCountInfo errorCount);
private: private:
void doShowMessage(const std::string& message, bool isError, bool showLoader); void doShowMessage(const std::string& message, bool isError, bool showLoader);
void doSetErrorCount(size_t count); void doSetErrorCount(ErrorCountInfo errorCount);
QtThreadedFunctor<const std::string&, bool, bool> m_showMessageFunctor; QtThreadedFunctor<const std::string&, bool, bool> m_showMessageFunctor;
QtThreadedFunctor<size_t> m_setErrorCountFunctor; QtThreadedFunctor<ErrorCountInfo> m_setErrorCountFunctor;
std::shared_ptr<QtStatusBar> m_widget; std::shared_ptr<QtStatusBar> m_widget;
}; };
@@ -54,7 +54,7 @@ void CxxDiagnosticConsumer::HandleDiagnostic(clang::DiagnosticsEngine::Level lev
return; return;
} }
if (level == clang::DiagnosticsEngine::Error || level == clang::DiagnosticsEngine::Fatal) if (level >= clang::DiagnosticsEngine::Error)
{ {
llvm::SmallString<100> messageStr; llvm::SmallString<100> messageStr;
info.FormatDiagnostic(messageStr); info.FormatDiagnostic(messageStr);
@@ -82,7 +82,7 @@ void CxxDiagnosticConsumer::HandleDiagnostic(clang::DiagnosticsEngine::Level lev
// if (m_fileManager->hasFilePath(filePath)) // if (m_fileManager->hasFilePath(filePath))
if (m_fileManager) if (m_fileManager)
{ {
m_client->onError(ParseLocation(filePath, line, column), message); m_client->onError(ParseLocation(filePath, line, column), message, (level == clang::DiagnosticsEngine::Fatal));
} }
} }
} }
+3 -3
View File
@@ -2794,14 +2794,14 @@ private:
{ {
} }
virtual void onError(const ParseLocation& location, const std::string& message) virtual void onError(const ParseLocation& location, const std::string& message, bool fatal)
{ {
errors.push_back(addLocationSuffix(message, location)); errors.push_back(addLocationSuffix(message, location));
} }
virtual size_t getErrorCount() const virtual ErrorCountInfo getErrorCount() const
{ {
return 0; return ErrorCountInfo();
} }
virtual Id onTypedefParsed( virtual Id onTypedefParsed(